mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
3494353641
* refactor(web): use absolute imports with aliases Refactors all of the TS/JS frontend to utilise absolute imports along with import aliases. Each of the paths within `src` are represented with their own alias: * @assets * @components * @constants (new) * @hooks * @layouts * @models * @services * @themes * @utils * @views `Routes.ts` and `constant.ts` have been relocated to the constants directory for consistency.
37 lines
882 B
TypeScript
37 lines
882 B
TypeScript
import { FirstFactorPath } from "@services/Api";
|
|
import { PostWithOptionalResponse } from "@services/Client";
|
|
import { SignInResponse } from "@services/SignIn";
|
|
|
|
interface PostFirstFactorBody {
|
|
username: string;
|
|
password: string;
|
|
keepMeLoggedIn: boolean;
|
|
targetURL?: string;
|
|
requestMethod?: string;
|
|
}
|
|
|
|
export async function postFirstFactor(
|
|
username: string,
|
|
password: string,
|
|
rememberMe: boolean,
|
|
targetURL?: string,
|
|
requestMethod?: string,
|
|
) {
|
|
const data: PostFirstFactorBody = {
|
|
username,
|
|
password,
|
|
keepMeLoggedIn: rememberMe,
|
|
};
|
|
|
|
if (targetURL) {
|
|
data.targetURL = targetURL;
|
|
}
|
|
|
|
if (requestMethod) {
|
|
data.requestMethod = requestMethod;
|
|
}
|
|
|
|
const res = await PostWithOptionalResponse<SignInResponse>(FirstFactorPath, data);
|
|
return res ? res : ({} as SignInResponse);
|
|
}
|