Go REST
M

Why am i not being able to fetch the newly created user

Muhammed Sainal K.K over 1 year ago 2677 views 3 replies

I have created a new user and the status is showing a green go but when i check the users it isnt showing up why
i have tried reloading also
also when i edit the user the user just get disappeared all of sudden and not even using relaod am being able to bring them back

3 replies
Z
zeevy over 1 year ago

to get the user that you created or modified, you need pass the access token, without access token you will get only public data

M
Muhammed Sainal K.K over 1 year ago

I have did it bruhh
Heres my code

export const httpClient = axios.create({ baseURL:'https://gorest.co.in/public/v2/', headers: { Authorization: access token } })

export const useCreateUser = ()=>{
const queryClient = useQueryClient()
return useMutation({
mutationFn:(user:UserType)=> httpClient.post(users,user),
onSuccess:()=> queryClient.invalidateQueries({queryKey:[DataQueryKey.users]})
})
}

M
Muhammed Sainal K.K over 1 year ago

Yep got It
Gosshhh i gotta start reading moree

Thanks alot Dude ...
appreciate the help

Your reply

Markdown supported