From 12178e84690d27b3eda91841eea7762964331d82 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 19 Apr 2025 14:54:25 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- backend/src/controllers/auth.ts | 10 +++++----- .../src/exceptions/exception-with-http-state.ts | 2 +- backend/src/exceptions/has-status-code.ts | 2 +- backend/src/middleware/auth/auth.ts | 2 +- backend/src/services/students.ts | 2 +- backend/src/services/teachers.ts | 2 +- frontend/src/router/index.ts | 2 +- frontend/src/services/auth/auth-service.ts | 2 +- frontend/src/views/CallbackPage.vue | 14 +++++++++++--- 9 files changed, 23 insertions(+), 15 deletions(-) diff --git a/backend/src/controllers/auth.ts b/backend/src/controllers/auth.ts index cab82da3..49e2159b 100644 --- a/backend/src/controllers/auth.ts +++ b/backend/src/controllers/auth.ts @@ -4,7 +4,7 @@ import { AuthenticatedRequest } from '../middleware/auth/authenticated-request.j import { createOrUpdateStudent } from '../services/students.js'; import { createOrUpdateTeacher } from '../services/teachers.js'; import { envVars, getEnvVar } from '../util/envVars.js'; -import { Response } from "express"; +import { Response } from 'express'; interface FrontendIdpConfig { authority: string; @@ -43,20 +43,20 @@ export function getFrontendAuthConfig(): FrontendAuthConfig { export async function postHelloHandler(req: AuthenticatedRequest, res: Response): Promise { const auth = req.auth; if (!auth) { - throw new UnauthorizedException("Cannot say hello when not authenticated."); + throw new UnauthorizedException('Cannot say hello when not authenticated.'); } const userData = { id: auth.username, username: auth.username, firstName: auth.firstName ?? '', - lastName: auth.lastName ?? '' + lastName: auth.lastName ?? '', }; - if (auth.accountType === "student") { + if (auth.accountType === 'student') { await createOrUpdateStudent(userData); logger.debug(`Synchronized student ${userData.username} with IDP`); } else { await createOrUpdateTeacher(userData); logger.debug(`Synchronized teacher ${userData.username} with IDP`); } - res.status(200).send({ message: "Welcome!" }); + res.status(200).send({ message: 'Welcome!' }); } diff --git a/backend/src/exceptions/exception-with-http-state.ts b/backend/src/exceptions/exception-with-http-state.ts index 1c25ef6c..5f12e25d 100644 --- a/backend/src/exceptions/exception-with-http-state.ts +++ b/backend/src/exceptions/exception-with-http-state.ts @@ -1,4 +1,4 @@ -import { HasStatusCode } from "./has-status-code"; +import { HasStatusCode } from './has-status-code'; /** * Exceptions which are associated with a HTTP error code. diff --git a/backend/src/exceptions/has-status-code.ts b/backend/src/exceptions/has-status-code.ts index f79e0ce6..46b8e491 100644 --- a/backend/src/exceptions/has-status-code.ts +++ b/backend/src/exceptions/has-status-code.ts @@ -1,5 +1,5 @@ export interface HasStatusCode { - status: number + status: number; } export function hasStatusCode(err: unknown): err is HasStatusCode { return typeof err === 'object' && err !== null && 'status' in err && typeof (err as HasStatusCode)?.status === 'number'; diff --git a/backend/src/middleware/auth/auth.ts b/backend/src/middleware/auth/auth.ts index 55ef896e..73a65b9a 100644 --- a/backend/src/middleware/auth/auth.ts +++ b/backend/src/middleware/auth/auth.ts @@ -48,7 +48,7 @@ const idpConfigs = { const verifyJwtToken = expressjwt({ secret: async (_: express.Request, token: jwt.Jwt | undefined) => { if (!token?.payload || !(token.payload as JwtPayload).iss) { - throw new UnauthorizedException("Invalid token.") + throw new UnauthorizedException('Invalid token.'); } const issuer = (token.payload as JwtPayload).iss; diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 8841f8a7..bf4c7c65 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -71,7 +71,7 @@ export async function createOrUpdateStudent(userData: StudentDTO): Promise { diff --git a/frontend/src/services/auth/auth-service.ts b/frontend/src/services/auth/auth-service.ts index 223466d5..9151e0a9 100644 --- a/frontend/src/services/auth/auth-service.ts +++ b/frontend/src/services/auth/auth-service.ts @@ -141,7 +141,7 @@ apiClient.interceptors.request.use( // Registering interceptor to refresh the token when a request failed because it was expired. apiClient.interceptors.response.use( (response) => response, - async (error: AxiosError<{ message?: string, inner?: {message?: string} }>) => { + async (error: AxiosError<{ message?: string; inner?: { message?: string } }>) => { if (error.response?.status === 401) { // If the user should already be logged in, his token is probably just expired. if (isLoggedIn.value) { diff --git a/frontend/src/views/CallbackPage.vue b/frontend/src/views/CallbackPage.vue index 0e532c24..cd004eae 100644 --- a/frontend/src/views/CallbackPage.vue +++ b/frontend/src/views/CallbackPage.vue @@ -15,18 +15,26 @@ await auth.handleLoginCallback(); await router.replace("/user"); // Redirect to theme page } catch (error) { - errorMessage.value = `${ t('loginUnexpectedError') }: ${error}`; + errorMessage.value = `${t("loginUnexpectedError")}: ${error}`; } });