style: create project modal (#1628)

* style: create project modal

* fix: build error

* fix: modal width
This commit is contained in:
Aaryan Khandelwal 2023-07-23 22:14:26 +05:30 committed by GitHub
parent ccbcfecc6d
commit a7b5ad55ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 273 additions and 191 deletions

View file

@ -58,6 +58,7 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
const handleClose = () => {
setIsDeleteLoading(false);
const timer = setTimeout(() => {
setConfirmProjectName("");
setConfirmDeleteMyProject(false);
@ -71,20 +72,27 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
setIsDeleteLoading(true);
mutate<IProject[]>(
PROJECTS_LIST(workspaceSlug as string, { is_favorite: "all" }),
(prevData) => prevData?.filter((project: IProject) => project.id !== data.id),
false
);
await projectService
.deleteProject(workspaceSlug as string, data.id, user)
.then(() => {
handleClose();
mutate<IProject[]>(
PROJECTS_LIST(workspaceSlug as string, { is_favorite: "all" }),
(prevData) => prevData?.filter((project: IProject) => project.id !== data.id),
false
);
if (onSuccess) onSuccess();
})
.catch(() => setIsDeleteLoading(false));
.catch(() =>
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again later.",
})
)
.finally(() => setIsDeleteLoading(false));
};
return (