diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx index f5b48b52a1f..d6657528292 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { useRouter } from "next/router"; @@ -39,6 +39,8 @@ const defaultValues = { }; const ArchivedIssueDetailsPage: NextPage = () => { + const [isRestoring, setIsRestoring] = useState(false); + const router = useRouter(); const { workspaceSlug, projectId, archivedIssueId } = router.query; @@ -117,6 +119,8 @@ const ArchivedIssueDetailsPage: NextPage = () => { const handleUnArchive = async () => { if (!workspaceSlug || !projectId || !archivedIssueId) return; + setIsRestoring(true); + await issuesService .unarchiveIssue(workspaceSlug as string, projectId as string, archivedIssueId as string) .then(() => { @@ -133,7 +137,8 @@ const ArchivedIssueDetailsPage: NextPage = () => { title: "Error!", message: "Something went wrong. Please try again.", }); - }); + }) + .finally(() => setIsRestoring(false)); }; return ( @@ -153,8 +158,8 @@ const ArchivedIssueDetailsPage: NextPage = () => { } > {issueDetails && projectId ? ( -