I am currently working on a web form developed using VueJS that enables authenticated users to modify their passwords. The backend system relies on Firebase, and I am facing a challenge in validating the user's current password before initiating the password-change API request.
The snippet of code I have implemented looks something like this:
rules: {
...
isPreviousPassword: v => {
var credentials = await firebase.auth().currentUser
.reauthenticateWithCredential(
firebase.auth.EmailAuthProvider.credential(
firebase.auth().currentUser.email,
v)
)
return credentials || 'Your password is incorrect'
}
}
When executing this code, Babel throws an error message as follows:
Syntax Error: await is a reserved word
Despite searching for solutions online, I haven't been able to resolve this issue. Even the proposed code snippets fail under Babel, prompting the same error message mentioned above.
Could someone provide insight into the best approach to address this problem?