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.
16 lines
575 B
TypeScript
16 lines
575 B
TypeScript
import { Configuration } from "@models/Configuration";
|
|
import { ConfigurationPath } from "@services/Api";
|
|
import { Get } from "@services/Client";
|
|
import { toEnum, Method2FA } from "@services/UserPreferences";
|
|
|
|
interface ConfigurationPayload {
|
|
available_methods: Method2FA[];
|
|
second_factor_enabled: boolean;
|
|
totp_period: number;
|
|
}
|
|
|
|
export async function getConfiguration(): Promise<Configuration> {
|
|
const config = await Get<ConfigurationPayload>(ConfigurationPath);
|
|
return { ...config, available_methods: new Set(config.available_methods.map(toEnum)) };
|
|
}
|