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.
|
// Calls the API to fetch a project.
|
||||||
export const fetchProject = projectId => async dispatch => {
|
export const fetchProject = slug => async dispatch => {
|
||||||
dispatch(fetchProjectRequest());
|
dispatch(fetchProjectRequest());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await getApi(`project/projects/${projectId}`);
|
const response = await getApi(`project/projects/${slug}`);
|
||||||
const projects = response.data;
|
const projects = response.data;
|
||||||
|
|
||||||
dispatch(fetchProjectSuccess(projects));
|
dispatch(fetchProjectSuccess(projects));
|
||||||
|
@ -30,10 +30,8 @@ class Project extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ready = async () => {
|
ready = async () => {
|
||||||
const { fetchProject } = this.props;
|
const { fetchProject, slug } = this.props;
|
||||||
await fetchProject(
|
await fetchProject(slug);
|
||||||
this.props.currentProject && this.props.currentProject._id
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -249,11 +247,13 @@ const mapDispatchToProps = dispatch => {
|
|||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
const project = state.project.project.project || {};
|
const project = state.project.project.project || {};
|
||||||
const projectUsers = state.project.projectTeam;
|
const projectUsers = state.project.projectTeam;
|
||||||
|
const { slug } = props.match.params;
|
||||||
const currentProject = state.project.projects.projects.find(el => {
|
const currentProject = state.project.projects.projects.find(el => {
|
||||||
return el.slug === props.match.params.slug;
|
return el.slug === props.match.params.slug;
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
project,
|
project,
|
||||||
|
slug,
|
||||||
currentProject,
|
currentProject,
|
||||||
projectUsers,
|
projectUsers,
|
||||||
adminNote: state.adminNote,
|
adminNote: state.adminNote,
|
||||||
@ -274,6 +274,7 @@ Project.propTypes = {
|
|||||||
fetchProjectTeam: PropTypes.func.isRequired,
|
fetchProjectTeam: PropTypes.func.isRequired,
|
||||||
projectUsers: PropTypes.object.isRequired,
|
projectUsers: PropTypes.object.isRequired,
|
||||||
paginate: PropTypes.func.isRequired,
|
paginate: PropTypes.func.isRequired,
|
||||||
|
slug: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
Project.displayName = 'Project';
|
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,
|
req,
|
||||||
res
|
res
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const projectId = req.params.projectId;
|
const slug = req.params.slug;
|
||||||
const project = await ProjectService.findOneBy({
|
const project = await ProjectService.findOneBy({
|
||||||
_id: projectId,
|
slug: slug,
|
||||||
deleted: { $ne: null },
|
deleted: { $ne: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user