mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
19 lines
407 B
JavaScript
19 lines
407 B
JavaScript
|
import { methodNotAllowed, ok } from 'next-basics';
|
||
|
import { useAuth } from 'lib/middleware';
|
||
|
import redis from 'lib/redis';
|
||
|
import { getAuthToken } from 'lib/auth';
|
||
|
|
||
|
export default async (req, res) => {
|
||
|
await useAuth(req, res);
|
||
|
|
||
|
if (req.method === 'POST') {
|
||
|
if (redis.enabled) {
|
||
|
await redis.del(`auth:${getAuthToken(req)}`);
|
||
|
}
|
||
|
|
||
|
return ok(res);
|
||
|
}
|
||
|
|
||
|
return methodNotAllowed(res);
|
||
|
};
|