[Q&A] On-Demand ISR 구현 중 질문 #137
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
문제 상황
/item/:idpage에서 '수정하기' 버튼을 클릭하면PATCH /items/:idAPI를 호출합니다./및/items/:idpage에 대해/api/revalidateAPI를 호출해서 page를 재생성 합니다./)에 반영됩니다.관련 코드
/pages/api/revalidate/index.ts: POST 요청의 body에 전달된 path들에 대해res.revalidate()를 각각 호출하여 해당 page를 재생성 하도록 구현했습니다./pages/items/[id]/index.tsx: Item detail page 입니다.Page컴포넌트 함수의handleEditClickcallback 함수에서,await editTodo()함수를 호출해서 데이터 수정 요청을 보내고,await revalidate()함수를 호출해서 page를 재생성한 뒤,router.push("/")를 호출해서 home page로 이동합니다./pages/index.tsx: Home page 입니다.