mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
24 lines
489 B
TypeScript
24 lines
489 B
TypeScript
import { cookies } from 'next/headers';
|
|
import { redirect } from 'next/navigation';
|
|
|
|
export default function SignOutSection() {
|
|
const signOut = async () => {
|
|
'use server';
|
|
cookies().set({
|
|
name: 'customerAccessToken',
|
|
value: '',
|
|
httpOnly: true,
|
|
path: '/',
|
|
expires: new Date(Date.now()),
|
|
});
|
|
redirect('/account/login');
|
|
};
|
|
return (
|
|
<form action={signOut} noValidate>
|
|
<button type="submit" className="text-primary/50">
|
|
Sign out
|
|
</button>
|
|
</form>
|
|
);
|
|
}
|