Two warnings are triggered by the code block below
- ESLint Warning: Avoid using async function as Promise executor.
(no-async-promise-executor)
- ESLint Warning: Function argument expects void return, but returns a Promise instead.
(@typescript-eslint/no-misused-promises)
How can we refactor this code to eliminate these warning messages?
async handleLogin(email: string, password: string, redirectTo: string): Promise<unknown> {
return new Promise(async (resolve, reject) => {
const { error, data } = await this.supabaseClient.auth.signIn(
{ email: email, password: password },
{ redirectTo: redirectTo }
);
if (error) {
reject(error);
} else {
resolve(data);
}
});
}