mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
사소한 리팩토링
This commit is contained in:
@@ -6,7 +6,7 @@ export const userInfoResponse = z.object({
|
||||
});
|
||||
export type UserInfoResponse = z.infer<typeof userInfoResponse>;
|
||||
|
||||
export const changeNicknameRequest = z.object({
|
||||
export const nicknameChangeRequest = z.object({
|
||||
newNickname: z.string().min(2).max(8),
|
||||
});
|
||||
export type ChangeNicknameRequest = z.infer<typeof changeNicknameRequest>;
|
||||
export type NicknameChangeRequest = z.infer<typeof nicknameChangeRequest>;
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
let { data } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>메뉴</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="sticky top-0 bg-white px-6 py-4">
|
||||
<p class="font-semibold">{data.nickname}</p>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { error, text } from "@sveltejs/kit";
|
||||
import { authorize } from "$lib/server/modules/auth";
|
||||
import { changeNicknameRequest } from "$lib/server/schemas";
|
||||
import { nicknameChangeRequest } from "$lib/server/schemas";
|
||||
import { changeNickname } from "$lib/server/services/user";
|
||||
import type { RequestHandler } from "./$types";
|
||||
|
||||
export const POST: RequestHandler = async ({ locals, request }) => {
|
||||
const { userId } = await authorize(locals, "any");
|
||||
|
||||
const zodRes = changeNicknameRequest.safeParse(await request.json());
|
||||
const zodRes = nicknameChangeRequest.safeParse(await request.json());
|
||||
if (!zodRes.success) error(400, "Invalid request body");
|
||||
const { newNickname } = zodRes.data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user