Change verification call to canUpdateWebsite

This commit is contained in:
Guy Goldenberg 2023-07-26 14:36:58 +03:00 committed by GitHub
parent 7bfbe26485
commit ec48a4e325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite } from 'lib/auth';
import { canUpdateWebsite } from 'lib/auth';
import { useAuth, useCors } from 'lib/middleware';
import { NextApiResponse } from 'next';
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
@ -19,7 +19,7 @@ export default async (
const { id: websiteId } = req.query;
if (req.method === 'POST') {
if (!(await canViewWebsite(req.auth, websiteId))) {
if (!(await canUpdateWebsite(req.auth, websiteId))) {
return unauthorized(res);
}