mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
aceb904398
* Fixed issue with realtime page rendering. * fix auth, add pg extension (#1596) * Fixed change password issue. API refactoring. Closes #1592. * Fixed account lookup. * Fixed issue with accessing user dashboards. Closes #1590 * fix sort on dashboard (#1600) Co-authored-by: Brian Cao <brian@umami.is>
25 lines
591 B
JavaScript
25 lines
591 B
JavaScript
import { resetWebsite } from 'queries';
|
|
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
|
import { allowQuery } from 'lib/auth';
|
|
import { useAuth, useCors } from 'lib/middleware';
|
|
import { TYPE_WEBSITE } from 'lib/constants';
|
|
|
|
export default async (req, res) => {
|
|
await useCors(req, res);
|
|
await useAuth(req, res);
|
|
|
|
const { id: websiteId } = req.query;
|
|
|
|
if (req.method === 'POST') {
|
|
if (!(await allowQuery(req, TYPE_WEBSITE))) {
|
|
return unauthorized(res);
|
|
}
|
|
|
|
await resetWebsite(websiteId);
|
|
|
|
return ok(res);
|
|
}
|
|
|
|
return methodNotAllowed(res);
|
|
};
|