fix: corriger le ReferenceError dans artiste.create
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user