mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-22 09:13:37 +01:00
21 lines
444 B
JavaScript
21 lines
444 B
JavaScript
|
import { resetWebsite } from 'lib/queries';
|
||
|
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
|
||
|
import { allowQuery } from 'lib/auth';
|
||
|
|
||
|
export default async (req, res) => {
|
||
|
const { id } = req.query;
|
||
|
const websiteId = +id;
|
||
|
|
||
|
if (req.method === 'POST') {
|
||
|
if (!(await allowQuery(req))) {
|
||
|
return unauthorized(res);
|
||
|
}
|
||
|
|
||
|
await resetWebsite(websiteId);
|
||
|
|
||
|
return ok(res);
|
||
|
}
|
||
|
|
||
|
return methodNotAllowed(res);
|
||
|
};
|