Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions UI/src/pages/ProjectsDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,22 @@ const ProjectDetailsPage: React.FC<{ projectId: number }> = ({ projectId }) => {

const handleArchiveProject = async () => {
if (project?.project_id === undefined) return;
await archiveProject(project?.project_id, !archive);
queryClient.invalidateQueries({ queryKey: ["projects"] });
navigate("/");
try {
await archiveProject(project?.project_id, !archive);
toast({
variant: "success",
title: archive ? "Project restored successfully!" : "Project deleted successfully!",
});
queryClient.invalidateQueries({ queryKey: ["projects"] });
navigate("/");
} catch (error) {
console.log("error", error);
toast({
variant: "destructive",
title:
error instanceof Error ? error?.message : "Failed to perform operation",
});
}
};

const handleDownloadProject = async () => {
Expand Down
1 change: 1 addition & 0 deletions UI/src/store/useProjectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ export const useProjectDetailsStore = create<ProjectDetailsState>(
} catch (error) {
console.error("Failed to archive project:", error);
set({ error: "Error archiving project." });
throw error;
} finally {
set({ isLoading: false });
}
Expand Down