Merge branch 'dev' into refactor/linting
This commit is contained in:
commit
588c556949
37 changed files with 686 additions and 796 deletions
|
@ -2,11 +2,14 @@ import apiClient from "@/services/api-client.ts";
|
|||
import type { FrontendAuthConfig } from "@/services/auth/auth.d.ts";
|
||||
import type { UserManagerSettings } from "oidc-client-ts";
|
||||
|
||||
export const AUTH_CONFIG_ENDPOINT = "auth/config";
|
||||
|
||||
/**
|
||||
* Fetch the authentication configuration from the backend.
|
||||
*/
|
||||
export async function loadAuthConfig(): Promise<Record<string, UserManagerSettings>> {
|
||||
const authConfig = (await apiClient.get<FrontendAuthConfig>("auth/config")).data;
|
||||
const authConfigResponse = await apiClient.get<FrontendAuthConfig>(AUTH_CONFIG_ENDPOINT);
|
||||
const authConfig = authConfigResponse.data;
|
||||
return {
|
||||
student: {
|
||||
authority: authConfig.student.authority,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { computed, reactive } from "vue";
|
||||
import type { AuthState, Role, UserManagersForRoles } from "@/services/auth/auth.d.ts";
|
||||
import { User, UserManager } from "oidc-client-ts";
|
||||
import { loadAuthConfig } from "@/services/auth/auth-config-loader.ts";
|
||||
import { AUTH_CONFIG_ENDPOINT, loadAuthConfig } from "@/services/auth/auth-config-loader.ts";
|
||||
import authStorage from "./auth-storage.ts";
|
||||
import { loginRoute } from "@/config.ts";
|
||||
import apiClient from "@/services/api-client.ts";
|
||||
|
@ -108,7 +108,7 @@ async function logout(): Promise<void> {
|
|||
apiClient.interceptors.request.use(
|
||||
async (reqConfig) => {
|
||||
const token = authState?.user?.access_token;
|
||||
if (token) {
|
||||
if (token && reqConfig.url !== AUTH_CONFIG_ENDPOINT) {
|
||||
reqConfig.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
return reqConfig;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue