I want to update my user from nodejs:
[2022-11-04 20:29:42.480] http: PUT /api/users/1 (17 ms) 200
This is the code I use:
const updateData={
username: 'ezbezzegigen',
menus: [...user.menus.map((item)=>item.id), menu["data"].data.id],
}
const restaurant = await axios.put(
`http://localhost:1337/api/users/${user.id}`,
{
data: updateData
},
{
headers: {
Authorization: `Bearer ${jwt}`,
},
}
);
console.log(restaurant["data"])
And the console log shows the result is back, but no changes to the user, the username is the same
{
id: 1,
username: 'test1',
email: 'test1@test.com',
provider: 'local',
confirmed: true,
blocked: false,
createdAt: '2022-10-30T18:16:34.595Z',
updatedAt: '2022-11-04T19:29:42.475Z',
city: 'Budapest',
description: null,
hasDelivery: false,
role: {
id: 1,
name: 'Authenticated',
description: 'Default role given to authenticated user.',
type: 'authenticated',
createdAt: '2022-10-30T17:25:24.224Z',
updatedAt: '2022-11-04T19:29:20.741Z'
}
I have no idea why is it not working, in the ADMIN users-permission I granted all for Authenticated users.