fix: corriger le ReferenceError dans artiste.create

This commit is contained in:
2026-07-04 09:37:37 +04:00
parent f592d4ded7
commit 8b17882d6b
2 changed files with 88 additions and 4 deletions
+4 -4
View File
@@ -19,10 +19,10 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
].services.jwt.getToken(ctx)
if (id !== data.user.id) {
throw new UnauthorizedError('Opération non autorisée')
return ctx.unauthorized('Opération non autorisée')
}
} catch (err) {
throw new UnauthorizedError(ctx, err, 'Opération non autorisée')
return ctx.unauthorized('Opération non autorisée')
}
}
@@ -31,11 +31,11 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
})
if (!user) {
throw new NotFoundError('Utilisateur introuvable.')
return ctx.notFound('Utilisateur introuvable.')
}
if (user.id !== data.user.id || user.username !== data.user.username || user.email !== data.user.email) {
ctx.badRequest('Informations non valides.')
return ctx.badRequest('Informations non valides.')
}
const artiste = await strapi.db.query('api::artiste.artiste').findOne({