mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
25 lines
703 B
TypeScript
25 lines
703 B
TypeScript
|
import { FirstFactorPath } from "./Api";
|
||
|
import { PostWithOptionalResponse } from "./Client";
|
||
|
import { SignInResponse } from "./SignIn";
|
||
|
|
||
|
interface PostFirstFactorBody {
|
||
|
username: string;
|
||
|
password: string;
|
||
|
keepMeLoggedIn: boolean;
|
||
|
targetURL?: string;
|
||
|
}
|
||
|
|
||
|
export async function postFirstFactor(
|
||
|
username: string, password: string,
|
||
|
rememberMe: boolean, targetURL?: string) {
|
||
|
const data: PostFirstFactorBody = {
|
||
|
username, password,
|
||
|
keepMeLoggedIn: rememberMe
|
||
|
};
|
||
|
|
||
|
if (targetURL) {
|
||
|
data.targetURL = targetURL;
|
||
|
}
|
||
|
const res = await PostWithOptionalResponse<SignInResponse>(FirstFactorPath, data);
|
||
|
return res ? res : {} as SignInResponse;
|
||
|
}
|