Skip to content

Commit 093f74d

Browse files
committed
refactor: 로그아웃 시 logout API 호출 및 finally로 토큰 정리
1 parent 25da6f1 commit 093f74d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { toast } from "sonner";
22
import { clearTokens } from "@/shared/utils/auth";
3+
import { logout } from "@/widgets/signin/api/logout";
34

45
export const handleLogout = async () => {
56
try {
7+
await logout();
8+
} catch {
9+
} finally {
610
clearTokens();
7-
if (typeof window !== "undefined") {
8-
window.location.href = "/signin";
9-
}
1011
toast.success("로그아웃 되었습니다");
11-
} catch (error) {
12-
console.error(error);
13-
toast.error("로그아웃 중 오류가 발생했습니다. 다시 로그인해주세요.");
12+
window.location.href = "/signin";
1413
}
1514
};

0 commit comments

Comments
 (0)