Check reset token validity

This commit is contained in:
2023-06-12 16:25:38 +02:00
parent 3e5648afca
commit 1bd18133b3
4 changed files with 89 additions and 7 deletions

View File

@ -1,6 +1,10 @@
import { atom } from "jotai";
import { APIClient } from "./ApiClient";
export interface CheckResetTokenResponse {
name: string;
}
const TokenStateKey = "auth-token";
export class AuthApi {
@ -73,4 +77,19 @@ export class AuthApi {
jsonData: { mail: mail },
});
}
/**
* Check reset password token
*/
static async CheckResetPasswordToken(
token: string
): Promise<CheckResetTokenResponse> {
return (
await APIClient.exec({
uri: "/auth/check_reset_password_token",
method: "POST",
jsonData: { token: token },
})
).data;
}
}