Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
git-init-priyanshu committed Aug 8, 2024
1 parent 8f84cae commit 1a38a8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function Header() {

const logout = async () => {
const response = await LogoutAction();
console.log(response);
if (response.success) {
toast.success("Successfully logged out")
router.push('/api/auth/signin')
Expand Down
5 changes: 5 additions & 0 deletions app/components/Header/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ export const CreateNewDocument = async (userId: string) => {

export const LogoutAction = async () => {
try {
console.log("here1")
cookies().delete('token');
console.log("here2")
cookies().delete('next-auth.session-token');
console.log("here3")
signOut();
console.log("here4")

return { success: true, data: null };
} catch (e) {
console.log("here5")
console.error(e);
return { success: false, error: "Internal server error" };
}
Expand Down

0 comments on commit 1a38a8c

Please sign in to comment.