Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function RootLayout({
<MSWComponent>{children}</MSWComponent>
</main>
</ReactQueryProviders>
<Toast />
</body>
</html>
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/header/HeaderBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { usePathname, useRouter } from 'next/navigation';
import { useAuthStore } from '@/store/authStore';
import DropDown from '../drop-down/DropDown';
import { logout } from '@/features/auth/api/auth';
import { showToast } from '../toast/toast';

function HeaderBar() {
const pathname = usePathname();
Expand All @@ -18,7 +17,6 @@ function HeaderBar() {
if (value === 'LOGOUT') {
try {
await logout();
showToast({ message: '로그아웃 되었습니다 ', type: 'success' });
router.replace('/bookclub');
} catch (error) {
console.error('로그아웃 실패:', error);
Expand Down
6 changes: 5 additions & 1 deletion src/components/toast/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const defaultOptions: ToastOptions = {
};

export const showToast = ({ message, type }: ToastProps) => {
toast[type](message, defaultOptions);
if (type === 'success') {
toast.success(message, defaultOptions);
} else if (type === 'error') {
toast.error(message, defaultOptions);
}
};

export const Toast = () => {
Expand Down
1 change: 1 addition & 0 deletions src/features/auth/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const logout = async () => {
const { setIsLoggedIn, setUser } = useAuthStore.getState();
setIsLoggedIn(false);
setUser(null);
showToast({ message: '로그아웃 되었습니다 ', type: 'success' });
return response;
} catch (error) {
console.error('로그아웃 에러:', error);
Expand Down
Loading