umami/pages/api/auth/logout.js

16 lines
330 B
JavaScript
Raw Normal View History

2020-08-05 07:45:05 +02:00
import { serialize } from 'cookie';
import { AUTH_COOKIE_NAME } from 'lib/constants';
2020-10-01 07:34:16 +02:00
import { ok } from 'lib/response';
2020-08-05 07:45:05 +02:00
export default async (req, res) => {
const cookie = serialize(AUTH_COOKIE_NAME, '', {
path: '/',
httpOnly: true,
maxAge: 0,
});
res.setHeader('Set-Cookie', [cookie]);
2020-10-01 07:34:16 +02:00
return ok(res);
2020-08-05 07:45:05 +02:00
};