글쓰기 로컬 자동 저장 추가

This commit is contained in:
2026-05-02 10:35:28 +09:00
parent 6bc697bd95
commit 722e027f18
10 changed files with 223 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ definePageMeta({
const saving = ref(false)
const errorMessage = ref('')
const postForm = ref(null)
/**
* 새 게시물 저장
@@ -21,6 +22,7 @@ const savePost = async (payload) => {
body: payload
})
postForm.value?.clearAutosave()
await navigateTo(`/admin/posts/${post.id}`)
} catch (error) {
errorMessage.value = error?.data?.message || '글을 저장하지 못했습니다.'
@@ -43,6 +45,6 @@ const savePost = async (payload) => {
<p v-if="errorMessage" class="admin-post-editor__error mb-5 rounded border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
{{ errorMessage }}
</p>
<AdminPostForm submit-label=" 저장" :saving="saving" @submit="savePost" />
<AdminPostForm ref="postForm" submit-label=" 저장" :saving="saving" @submit="savePost" />
</section>
</template>