mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
* 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.
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { ConsentPath } from "@services/Api";
|
|
import { Post, Get } from "@services/Client";
|
|
|
|
interface ConsentPostRequestBody {
|
|
client_id: string;
|
|
accept_or_reject: "accept" | "reject";
|
|
}
|
|
|
|
interface ConsentPostResponseBody {
|
|
redirect_uri: string;
|
|
}
|
|
|
|
interface ConsentGetResponseBody {
|
|
client_id: string;
|
|
client_description: string;
|
|
scopes: Scope[];
|
|
audience: Audience[];
|
|
}
|
|
|
|
interface Scope {
|
|
name: string;
|
|
description: string;
|
|
}
|
|
|
|
interface Audience {
|
|
name: string;
|
|
description: string;
|
|
}
|
|
|
|
export function getRequestedScopes() {
|
|
return Get<ConsentGetResponseBody>(ConsentPath);
|
|
}
|
|
|
|
export function acceptConsent(clientID: string) {
|
|
const body: ConsentPostRequestBody = { client_id: clientID, accept_or_reject: "accept" };
|
|
return Post<ConsentPostResponseBody>(ConsentPath, body);
|
|
}
|
|
|
|
export function rejectConsent(clientID: string) {
|
|
const body: ConsentPostRequestBody = { client_id: clientID, accept_or_reject: "reject" };
|
|
return Post<ConsentPostResponseBody>(ConsentPath, body);
|
|
}
|