diff --git a/pages/api/user/bigwinner.ts b/pages/api/user/bigwinner.ts index 8ef3b61..35f702a 100644 --- a/pages/api/user/bigwinner.ts +++ b/pages/api/user/bigwinner.ts @@ -5,14 +5,10 @@ import { Role } from '../../../enum/role.enum'; export default async function updateUser(req: NextApiRequest, res: NextApiResponse) { const session = await getSession({ req }) - const { selectedUserRole, selectedUserEmail, selectedUserName, - selectedUserSurname, - selectedUserAddress, - selectedUserZipCode, - selectedUserPhoneNumber } = req.body; + // est-ce la méthode est un POST ou PUT? - if (req.method !== ("POST" || 'PUT')) { + if (!(['POST', 'PUT'].indexOf(req.method) > -1)) { throw new Error( `The HTTP ${req.method} method is not supported at this route.` ); diff --git a/pages/api/user/update.ts b/pages/api/user/update.ts index 70fd809..fa72f9d 100644 --- a/pages/api/user/update.ts +++ b/pages/api/user/update.ts @@ -12,7 +12,7 @@ export default async function updateUser(req: NextApiRequest, res: NextApiRespon selectedUserPhoneNumber } = req.body; // est-ce la méthode est un POST ou PUT? - if (req.method !== ("POST" || 'PUT')) { + if (!(['POST', 'PUT'].indexOf(req.method) > -1)) { throw new Error( `The HTTP ${req.method} method is not supported at this route.` );