authelia/web/src/services/OneTimePassword.ts
Clement Michaud 9ae2096d2a Rewrite authelia frontend to improve user experience.
This refactoring simplify the code of the frontend and prepare the
portal for receiving a user settings page and an admin page.
2019-12-05 11:05:24 +01:00

16 lines
524 B
TypeScript

import { PostWithOptionalResponse } from "./Client";
import { CompleteTOTPSignInPath } from "./Api";
import { SignInResponse } from "./SignIn";
interface CompleteU2FSigninBody {
token: string;
targetURL?: string;
}
export function completeTOTPSignIn(passcode: string, targetURL: string | undefined) {
const body: CompleteU2FSigninBody = { token: `${passcode}` };
if (targetURL) {
body.targetURL = targetURL;
}
return PostWithOptionalResponse<SignInResponse>(CompleteTOTPSignInPath, body);
}