mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: deactivate account post loading (#3022)
This commit is contained in:
parent
151ec259d8
commit
68dcfcd451
@ -1,7 +1,9 @@
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import { useTheme } from "next-themes";
|
||||
import { Dialog, Transition } from "@headlessui/react";
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { mutate } from "swr";
|
||||
// mobx store
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// ui
|
||||
@ -27,6 +29,7 @@ export const DeactivateAccountModal: React.FC<Props> = (props) => {
|
||||
const router = useRouter();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
const { setTheme } = useTheme();
|
||||
|
||||
const handleClose = () => {
|
||||
setIsDeactivating(false);
|
||||
@ -43,8 +46,10 @@ export const DeactivateAccountModal: React.FC<Props> = (props) => {
|
||||
title: "Success!",
|
||||
message: "Account deactivated successfully.",
|
||||
});
|
||||
handleClose();
|
||||
mutate("CURRENT_USER_DETAILS", null);
|
||||
setTheme("system");
|
||||
router.push("/");
|
||||
handleClose();
|
||||
})
|
||||
.catch((err) =>
|
||||
setToastAlert({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, {useState } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import { mutate } from "swr";
|
||||
import { useTheme } from "next-themes";
|
||||
@ -67,8 +67,10 @@ export const SwitchOrDeleteAccountModal: React.FC<Props> = (props) => {
|
||||
title: "Success!",
|
||||
message: "Account deleted successfully.",
|
||||
});
|
||||
handleClose();
|
||||
mutate("CURRENT_USER_DETAILS", null);
|
||||
setTheme("system");
|
||||
router.push("/");
|
||||
handleClose();
|
||||
})
|
||||
.catch((err) =>
|
||||
setToastAlert({
|
||||
|
@ -374,6 +374,9 @@ class UserStore implements IUserStore {
|
||||
deactivateAccount = async () => {
|
||||
try {
|
||||
await this.userService.deactivateAccount();
|
||||
this.currentUserError = null;
|
||||
this.currentUser = null;
|
||||
this.isUserLoggedIn = false;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user