Skip to content

Commit

Permalink
Merge pull request #232 from tdari/fix/error-message-on-leave
Browse files Browse the repository at this point in the history
fix: delete workspace from local storage on leave
  • Loading branch information
vinicvaz authored Feb 9, 2024
2 parents abc2a41 + 855cf1e commit a2a4f0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions frontend/src/context/workspaces/workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export const WorkspacesProvider: FC<IWorkspacesProviderProps> = ({
removeUserWorkspace({ workspaceId, userId })
.then(() => {
toast.success(`User removed successfully from workspace.`);
const storageWorkspace = JSON.parse(
localStorage.getItem("workspace") ?? "{}",
);
if (storageWorkspace && storageWorkspace.id === workspaceId) {
localStorage.removeItem("workspace");
setWorkspace(null);
}
void workspacesRefresh();
})
.catch((error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
Tooltip,
Chip,
} from "@mui/material";
import Stack from "@mui/material/Stack";
import { type IWorkspaceSummary } from "context/workspaces/types";
import { type FC } from "react";
import { useNavigate } from "react-router-dom";
Expand Down

0 comments on commit a2a4f0a

Please sign in to comment.