I am trying to save a token from DB and pass the token in the next API request in the body I have written the below code but it's not working, please help.
it.only('Change Password', () => {
cy.ResetPassAPI(globalThis.data.dradminemail);// this generates a token in DB
const resetoken = cy.task(
'queryDb',
`select _Token from tokens WHERE _Member_Id = 25372 and _Token_Type = "resetPassword" ORDER BY _id DESC LIMIT 1`,); // saving the token from DB generate from above
cy.request({
method: 'PATCH',
url: 'https://xxx/xx/xx/changePasswordWithToken',
body: {
confirmPassword: 'xxx',
password: 'xx',
token: resetoken, //passing the saved token from database
uid: 1234,
},
});
});