mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 15:49:10 +00:00
AdminD Reload Bug Fix
This commit is contained in:
parent
77ec1b93f5
commit
27246ee3c8
@ -75,11 +75,11 @@ export const fetchProjectError = error => {
|
||||
};
|
||||
|
||||
// Calls the API to fetch a project.
|
||||
export const fetchProject = projectId => async dispatch => {
|
||||
export const fetchProject = slug => async dispatch => {
|
||||
dispatch(fetchProjectRequest());
|
||||
|
||||
try {
|
||||
const response = await getApi(`project/projects/${projectId}`);
|
||||
const response = await getApi(`project/projects/${slug}`);
|
||||
const projects = response.data;
|
||||
|
||||
dispatch(fetchProjectSuccess(projects));
|
||||
|
@ -30,10 +30,8 @@ class Project extends Component {
|
||||
}
|
||||
|
||||
ready = async () => {
|
||||
const { fetchProject } = this.props;
|
||||
await fetchProject(
|
||||
this.props.currentProject && this.props.currentProject._id
|
||||
);
|
||||
const { fetchProject, slug } = this.props;
|
||||
await fetchProject(slug);
|
||||
};
|
||||
|
||||
render() {
|
||||
@ -249,11 +247,13 @@ const mapDispatchToProps = dispatch => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
const project = state.project.project.project || {};
|
||||
const projectUsers = state.project.projectTeam;
|
||||
const { slug } = props.match.params;
|
||||
const currentProject = state.project.projects.projects.find(el => {
|
||||
return el.slug === props.match.params.slug;
|
||||
});
|
||||
return {
|
||||
project,
|
||||
slug,
|
||||
currentProject,
|
||||
projectUsers,
|
||||
adminNote: state.adminNote,
|
||||
@ -274,6 +274,7 @@ Project.propTypes = {
|
||||
fetchProjectTeam: PropTypes.func.isRequired,
|
||||
projectUsers: PropTypes.object.isRequired,
|
||||
paginate: PropTypes.func.isRequired,
|
||||
slug: PropTypes.string,
|
||||
};
|
||||
|
||||
Project.displayName = 'Project';
|
||||
|
@ -839,14 +839,14 @@ router.get('/projects/allProjects', getUser, isUserMasterAdmin, async function(
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/projects/:projectId', getUser, isUserMasterAdmin, async function(
|
||||
router.get('/projects/:slug', getUser, isUserMasterAdmin, async function(
|
||||
req,
|
||||
res
|
||||
) {
|
||||
try {
|
||||
const projectId = req.params.projectId;
|
||||
const slug = req.params.slug;
|
||||
const project = await ProjectService.findOneBy({
|
||||
_id: projectId,
|
||||
slug: slug,
|
||||
deleted: { $ne: null },
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user