-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4880 from signalco-io/next
Next
- Loading branch information
Showing
6 changed files
with
98 additions
and
48 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
web/apps/workingparty/app/(rest)/(app)/app/logout/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use client'; | ||
|
||
import { useEffect } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { Spinner } from '@signalco/ui-primitives/Spinner'; | ||
import { KnownPages } from '../../../../../src/knownPages'; | ||
|
||
function useLogOut() { | ||
const router = useRouter(); | ||
|
||
return useMutation({ | ||
mutationFn: () => fetch('/api/auth/logout', { method: 'POST' }), | ||
onSettled: () => { | ||
router.push(KnownPages.Landing); | ||
}, | ||
}); | ||
} | ||
|
||
export default function AppLogoutPage() { | ||
const logOut = useLogOut(); | ||
|
||
useEffect(() => { | ||
logOut.mutate(); | ||
}, []); | ||
|
||
return ( | ||
<div className="flex h-full items-center justify-center"> | ||
<Spinner loadingLabel={'Logging you out'} loading /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { cookies } from 'next/headers'; | ||
|
||
export async function POST() { | ||
cookies().delete('wp_session'); | ||
return Response.json(null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.