diff --git a/.cloudbase-sites/preview.json b/.cloudbase-sites/preview.json index 9535b25..0d41aa0 100644 --- a/.cloudbase-sites/preview.json +++ b/.cloudbase-sites/preview.json @@ -1,12 +1,12 @@ { - "pid": 98343, - "port": 17174, + "pid": 24641, + "port": 17175, "host": "0.0.0.0", "base": "/", "framework": "vite-react", - "command": "/Users/jiaunun/.nvm/versions/node/v24.15.0/bin/node /Users/jiaunun/Desktop/36-character-flower/node_modules/vite/bin/vite.js --host 0.0.0.0 --port 17174 --strictPort --base /", - "internalUrl": "http://127.0.0.1:17174/", - "logPath": "/Users/jiaunun/Desktop/36-character-flower/.cloudbase-sites/logs/preview-1784093877629.log", + "command": "/Users/jiaunun/.nvm/versions/node/v24.15.0/bin/node /Users/jiaunun/Desktop/36-character-flower/node_modules/vite/bin/vite.js --host 0.0.0.0 --port 17175 --strictPort --base /", + "internalUrl": "http://127.0.0.1:17175/", + "logPath": "/Users/jiaunun/Desktop/36-character-flower/.cloudbase-sites/logs/preview-1784622161040.log", "cwd": "/Users/jiaunun/Desktop/36-character-flower", - "startedAt": "2026-07-15T05:37:58.655Z" + "startedAt": "2026-07-21T08:22:42.070Z" } diff --git a/src/api/auth-api.ts b/src/api/auth-api.ts index edc0d42..1ec9473 100644 --- a/src/api/auth-api.ts +++ b/src/api/auth-api.ts @@ -145,16 +145,18 @@ export async function logoutWithPassword( export async function registerWithPassword( payload: RegisterPayload, ): Promise { + const inviteCode = payload.inviteCode?.trim() ?? '' + const registerRequest: RegisterRequestDto = { + captcha: payload.captcha, + device_id: getAuthDeviceId(), + password: payload.password, + username: payload.mobile, + ...(inviteCode ? { invite_code: inviteCode } : {}), + } const response = await api.post( AUTH_ENDPOINTS.register, { - json: { - captcha: payload.captcha, - device_id: getAuthDeviceId(), - invite_code: payload.inviteCode, - password: payload.password, - username: payload.mobile, - }, + json: registerRequest, }, ) diff --git a/src/schema/auth-schema.ts b/src/schema/auth-schema.ts index a19fcf0..5f985da 100644 --- a/src/schema/auth-schema.ts +++ b/src/schema/auth-schema.ts @@ -35,7 +35,6 @@ export const registerFormSchema = z inviteCode: z .string() .trim() - .min(1, 'auth.validation.inviteCode.required') .max(INVITE_CODE_MAX_LENGTH, 'auth.validation.inviteCode.max'), password: passwordSchema, mobile: usernameSchema, diff --git a/src/type/auth.type.ts b/src/type/auth.type.ts index 895d0ab..1be2be3 100644 --- a/src/type/auth.type.ts +++ b/src/type/auth.type.ts @@ -120,7 +120,7 @@ export interface LogoutRequestDto { export interface RegisterRequestDto { captcha: string device_id?: string - invite_code: string + invite_code?: string password: string username: string } @@ -148,7 +148,7 @@ export type LogoutPayload = LoginPayload export interface RegisterPayload { captcha: string - inviteCode: string + inviteCode?: string mobile: string password: string }