fix: show toaster on project save and errors

pull/118/head
corpulent 3 years ago
parent a44e44cd0c
commit b4c9877218

@ -137,6 +137,7 @@ export const useUpdateProject = (uuid: string | undefined) => {
}, },
{ {
onSuccess: (projectData) => { onSuccess: (projectData) => {
toaster("Project saved!", "success");
queryClient.setQueryData(["projects", uuid], projectData); queryClient.setQueryData(["projects", uuid], projectData);
} }
} }
@ -157,9 +158,9 @@ export const useDeleteProject = (uuid: string | undefined) => {
return data; return data;
} catch (err: any) { } catch (err: any) {
if (err.response.status === 404) { if (err.response.status === 404) {
// console.error("Resource could not be found!"); toaster("Resource could not be found!", "error");
} else { } else {
// console.error(err.message); toaster(err.message, "error");
} }
} }
}, },
@ -180,6 +181,7 @@ export const useDeleteProject = (uuid: string | undefined) => {
} else { } else {
queryClient.invalidateQueries(["projects"]); queryClient.invalidateQueries(["projects"]);
} }
toaster("Project deleted!", "success");
} }
} }
); );

Loading…
Cancel
Save