-
다이어리 데이터 업데이트멈멈-토이프로젝트(next.js)2 2024. 9. 4. 13:34728x90
수파베이스 데이터 업데이트
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { e.preventDefault(); const { data, error } = await supabase .from("zwritedb") .update([ { id: pathId, uuid: dataUid, content: textValue, }, ]) .eq('id', pathId) .select("*"); router.push("/main/diary"); if (error) { throw error; } };
JSX 데이터 form
<form onSubmit={handleSubmit} key={item.id}> {/* <Suspense fallback={<p>로딩중...</p>}> */} <Deditwritebottomicon pathId={pathId} /> {/* </Suspense> */} <textarea name="content" className="resize-none border border-[#F5BB8C] w-full h-40 p-2.5 bg-transparent outline-none rounded-md" defaultValue={item.content} onChange={(e) => setTextValue(e.target.value)} required ></textarea> <button type="submit">등록999</button> <button type="button" onClick={handelCancle}> 취소 </button> </form>
큰 문제점은 없었다
내용만 수정 가능 하도록 설정
'멈멈-토이프로젝트(next.js)2' 카테고리의 다른 글
커뮤니티 이미지 업로드하기1-1 (0) 2024.09.04 다이어리 데이터 삭제 (0) 2024.09.04 다이어리 데이터 조회 (0) 2024.08.30 다이어리 데이터 추가 하기 (0) 2024.08.29 폴더 구조 코드 리팩토링 (2) 2024.08.28