Currently, I am tackling a Vue project that incorporates TypeScript and axios for handling API requests. While working on the Reset Password component, the resetPassword function within the auth.ts file appears as follows:
resetPassword(password1: string, password2: string, uid: string, token: string): Promise<any> {
return new Promise<any>((resolve, reject) => {
axios
.post("API", { password1, password2, uid, token })
.then((res : any) => {
resolve(//RESOLVE);
})
.catch((error) => {
//REJECT
})
})
}
Within my ResetPassword.vue file, I have utilized the newPassword variable in the following manner:
this.resetPassword(password1.value, password2.value, this.$route.params.id, this.$route.params.resetID).then(
(res) => {
if(password1.value == password2.value){
Notification{
"SUCCESS"
});
}
However, an error arises stating "Type 'string[]' is not assignable to type 'string'." when dealing with the 3rd parameter in the ResetPassword.vue file.
As I navigate through TypeScript, I require assistance. Should I proceed with this.$route.params.id as string or opt for this.$route.params.id.toString()?