We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25da6f1 commit 093f74dCopy full SHA for 093f74d
1 file changed
src/widgets/signin/lib/handleLogout.ts
@@ -1,15 +1,14 @@
1
import { toast } from "sonner";
2
import { clearTokens } from "@/shared/utils/auth";
3
+import { logout } from "@/widgets/signin/api/logout";
4
5
export const handleLogout = async () => {
6
try {
7
+ await logout();
8
+ } catch {
9
+ } finally {
10
clearTokens();
- if (typeof window !== "undefined") {
- window.location.href = "/signin";
- }
11
toast.success("로그아웃 되었습니다");
- } catch (error) {
12
- console.error(error);
13
- toast.error("로그아웃 중 오류가 발생했습니다. 다시 로그인해주세요.");
+ window.location.href = "/signin";
14
}
15
};
0 commit comments