Closed hieunm22 closed 2 years ago
hi all before I upgrade the package to v2.1.1 these pieces of code work fine previous version is "wretch": "^1.7.10"
"wretch": "^1.7.10"
const CLIENT_BASE_URL = `${process.env.REACT_APP_BACKEND_BASE_URL}/api` const request = wretch(CLIENT_BASE_URL)
export const uploadImage = (token: string, form: FormData) => request.url(EP.uploadAvatar) .auth(`Bearer ${token}`) .formData(form) // Property 'formData' does not exist on type 'Wretch<unknown, unknown, undefined>'.ts(2339) .post() .json(uploadAvatarCallback) .catch(handleError)
export const loadResetPassword = (token: string, uid: number, tokenReset: string) => request.url(EP.resetPassword) .auth(`Bearer ${token}`) .headers({ "LostPasswordURL": "/lostpassword" }) .query({ uid, token: tokenReset }) // Property 'query' does not exist on type 'Wretch<unknown, unknown, undefined>'.ts(2339) .get() .json(resetPasswordCallback) .catch(handleError)
so how to fix them in v2.1.1
thanks
Hi @hieunm22,
To use the .query and .formData methods you need to use addons with wretch v2, please check the migration guide .
.query
.formData
hi all before I upgrade the package to v2.1.1 these pieces of code work fine previous version is
"wretch": "^1.7.10"
so how to fix them in v2.1.1
thanks