mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
20 lines
496 B
TypeScript
20 lines
496 B
TypeScript
import { methodNotAllowed, ok } from 'next-basics';
|
|
import redis from '@umami/redis-client';
|
|
import { useAuth } from 'lib/middleware';
|
|
import { getAuthToken } from 'lib/auth';
|
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|
await useAuth(req, res);
|
|
|
|
if (req.method === 'POST') {
|
|
if (redis.enabled) {
|
|
await redis.del(getAuthToken(req));
|
|
}
|
|
|
|
return ok(res);
|
|
}
|
|
|
|
return methodNotAllowed(res);
|
|
};
|