chore: fix linting in entire project

This commit is contained in:
mrjvs
2026-08-09 21:28:45 +02:00
parent 843f1abdde
commit 2400e98d8f
41 changed files with 350 additions and 264 deletions

View File

@@ -1,17 +1,19 @@
import { hcaptchaVerify } from "~~/server/utils/hcaptcha";
import { ForgotPasswordSchema } from "~~/shared/api-types";
import { hcaptchaVerify } from '~~/server/utils/hcaptcha';
import { ForgotPasswordSchema } from '~~/shared/api-types';
export default defineEventHandler(async (event): Promise<void> => {
const body = await readZodBody(event, ForgotPasswordSchema);
const grpc = useApiGrpc(event);
const captchaResult = await hcaptchaVerify(event, body.captchaResponse);
if (!captchaResult) throw createError({
status: 400,
message: 'Invalid captcha',
});
if (!captchaResult) {
throw createError({
status: 400,
message: 'Invalid captcha'
});
}
await grpc.forgotPassword({
emailAddressOrUsername: body.emailOrPassword,
})
emailAddressOrUsername: body.emailOrPassword
});
});

View File

@@ -1,6 +1,6 @@
import { ServerError } from "nice-grpc";
import { ApiAuthLogin, LoginSchema } from "#shared/api-types"
import { useLegacyApiGrpc } from "~~/server/utils/useGrpc";
import { ServerError } from 'nice-grpc';
import { LoginSchema } from '#shared/api-types';
import type { ApiAuthLogin } from '#shared/api-types';
export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
const body = await readZodBody(event, LoginSchema);

View File

@@ -1,4 +1,4 @@
import type { GetApiAuthMe } from "#shared/api-types"
import type { GetApiAuthMe } from '#shared/api-types';
export default defineEventHandler(async (event): Promise<GetApiAuthMe> => {
const auth = enforceLoggedIn(event);
@@ -8,9 +8,11 @@ export default defineEventHandler(async (event): Promise<GetApiAuthMe> => {
return {
pid: data.pid,
username: data.username,
mii: data.mii ? {
imageUrl: `https://r2-cdn.pretendo.cc/mii/${data.pid}/normal_face.png`,
name: data.mii.name,
} : null,
mii: data.mii
? {
imageUrl: `https://r2-cdn.pretendo.cc/mii/${data.pid}/normal_face.png`,
name: data.mii.name
}
: null
};
});

View File

@@ -1,9 +1,11 @@
import { ApiAuthLogin, RegisterSchema } from "#shared/api-types"
import { RegisterSchema } from '#shared/api-types';
import type { ApiAuthLogin } from '#shared/api-types';
export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
const body = await readZodBody(event, RegisterSchema);
const grpc = useApiGrpc(event);
// eslint-disable-next-line no-useless-catch -- Temp before error handling is implemented
try {
// TODO Add ip
// TODO Add birthday
@@ -13,7 +15,7 @@ export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
captchaResponse: body.captchaResponse,
username: body.username,
password: body.password,
passwordConfirm: body.password,
passwordConfirm: body.password
});
return {
@@ -21,6 +23,7 @@ export default defineEventHandler(async (event): Promise<ApiAuthLogin> => {
refreshToken: res.refreshToken
};
} catch (error: unknown) {
// TODO handle errors
throw error;
}
});

View File

@@ -1,4 +1,4 @@
import { ResetPasswordSchema } from "~~/shared/api-types";
import { ResetPasswordSchema } from '~~/shared/api-types';
export default defineEventHandler(async (event): Promise<void> => {
const body = await readZodBody(event, ResetPasswordSchema);
@@ -7,6 +7,6 @@ export default defineEventHandler(async (event): Promise<void> => {
await grpc.resetPassword({
password: body.password,
passwordConfirm: body.passwordConfirm,
token: body.resetToken,
})
token: body.resetToken
});
});