Posts
Q&A
๊ฐ์ฒด ํ์ ์ ํธํ์ฑ
๋ค์ ์น์ ์ ๋ณด๋๊น const ๋จ์ธ์ ์ฌ์ฉํด์ readonly๋ก ์์ ๋ถ๊ฐ๋ฅํ๊ฒ ๋๋ค์
- 0
- 2
- 138
Q&A
ํ ๋ผ์ฐํธ ์บ์1 ์ง๋ฌธ
์ ๋ค์ ๊ฐ์ข๋ฅผ ๋ณด๋ 1๋ฒ์ ๋ํ ๋ต๋ณ์๋ฆฌ์กํธ์์ ์ ๊ณตํด์ฃผ๋ Suspense์ปดํฌ๋ํธ๋ฅผ ํตํด์ ์ฌ์ ๋ ๋๋ง ๊ณผ์ ์๋ ํฌํจ๋์ง์๊ณ ํด๋ผ์ด์ธํธ ์ธก์์๋ง ์คํ๋๋๋ก ํด์ฃผ๊ณ ์๋ค์
- 0
- 3
- 335
Q&A
ํ์ ์คํฌ๋ฆฝํธ ์ง๋ฌธ
์ ๊ฐ์ฌ๋๋ถ์ฒ๋ผ ํด๋ดค๋๋ฐ๋ ์๋ฌ๊ฐ ๋จ๋ค์ฉ...signupModal.tsximport onSubmit from "../_lib/signup"; const [state, formAction] = useFormState(onSubmit, { message: null }); signup.ts ํ์ผ"use server"; import {redirect} from "next/navigation"; export default async (prevState: any, formData: FormData) => { if (!formData.get('id') || !(formData.get('id') as string)?.trim()) { return { message: 'no_id' }; } if (!formData.get('name') || !(formData.get('name') as string)?.trim()) { return { message: 'no_name' }; } if (!formData.get('password') || !(formData.get('password') as string)?.trim()) { return { message: 'no_password' }; } if (!formData.get('image')) { return { message: 'no_image' }; } let shouldRedirect = false; try { const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/users`, { method: 'post', body: formData, credentials: 'include', }) console.log(response.status); if (response.status === 403) { return { message: 'user_exists' }; } console.log(await response.json()) shouldRedirect = true; await signIn("credentials", { username: formData.get('id'), password: formData.get('password'), redirect: false, }) } catch (err) { console.error(err); return; } if (shouldRedirect) { redirect('/home'); // try/catch๋ฌธ ์์์ X } }์ด๋ ๊ฒ ํ๋๋ฐ useFormState์ onSubmit๋ถ๋ถ์์ ๋ฐ์ ์ฝ๋์ฒ๋ผ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค์ใ ใ ใ ใ Argument of type '(prevState: any, formData: FormData) => Promise' is not assignable to parameter of type '(state: { message: string | null; }) => { message: string | null; } | Promise'. Target signature provides too few arguments. Expected 2 or more, but got 1.
- 0
- 3
- 1.1K
Q&A
Vue3 Composition API - computed
๋ค์ ๋ค์ผ๋ fullName.value์ ๊ฐ์ ๋์ ํ๋ฉด setํจ์์ ๋งค๊ฐ๋ณ์๋ก ๋ค์ด๊ฐ๋ค๊ณ ํ์ จ๋๋ฐ ๋ฌด์กฐ๊ฑด .value๋ก ์ ๊ทผ์ ํด์ผ ํ๋๊ฒ์ธ๊ฐ์?
- 0
- 1
- 409