18 lines
No EOL
472 B
TypeScript
18 lines
No EOL
472 B
TypeScript
'use server';
|
|
|
|
import { withClientErrorHandler } from '@/withClientErrorHandler/withClientErrorHandler';
|
|
import { cookies } from 'next/headers';
|
|
|
|
import { redirect } from 'next/navigation';
|
|
|
|
async function executeUserLogoutService(token: string) {
|
|
const cookieStore = await cookies();
|
|
cookieStore.set(token, '', {
|
|
expires: new Date(0),
|
|
path: '/',
|
|
});
|
|
|
|
redirect('/login');
|
|
}
|
|
|
|
export const UserLogoutService = withClientErrorHandler(executeUserLogoutService) |