Skip to content

Commit

Permalink
fix(api): show project not found page if api throws 404
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Aug 28, 2024
1 parent bfb1a96 commit d50af65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/frontend/src/api/CreateProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ const GetIndividualProjectDetails = (url: string) => {
dispatch(CreateProjectActions.SetIndividualProjectDetails(modifiedResponse));
dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false));
} catch (error) {
if (error.response.status === 404) {
dispatch(CommonActions.SetProjectNotFound(true));
}
dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false));
} finally {
dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false));
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/src/api/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export const ProjectById = (projectId: string) => {
);
dispatch(ProjectActions.SetProjectDetialsLoading(false));
} catch (error) {
if (error.response.status === 404) {
dispatch(CommonActions.SetProjectNotFound(true));
}
dispatch(ProjectActions.SetProjectDetialsLoading(false));
dispatch(
CommonActions.SetSnackBar({
Expand Down Expand Up @@ -221,6 +224,9 @@ export const GetProjectDashboard = (url: string) => {
dispatch(ProjectActions.SetProjectDashboardDetail(response.data));
dispatch(ProjectActions.SetProjectDashboardLoading(false));
} catch (error) {
if (error.response.status === 404) {
dispatch(CommonActions.SetProjectNotFound(true));
}
dispatch(ProjectActions.SetProjectDashboardLoading(false));
} finally {
dispatch(ProjectActions.SetProjectDashboardLoading(false));
Expand Down

0 comments on commit d50af65

Please sign in to comment.