v0.1.14 - 서버 삭제 동기화 추가

This commit is contained in:
2026-04-21 18:20:33 +09:00
parent a53ef4cc6f
commit 20564ba34b
6 changed files with 55 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ import {
readAuthState,
signup,
} from './lib/authClient'
import { fetchPlannerEntries, savePlannerEntry } from './lib/plannerApi'
import { deletePlannerEntry, fetchPlannerEntries, savePlannerEntry } from './lib/plannerApi'
import {
createInitialPlannerRecords,
persistPlannerState,
@@ -739,7 +739,7 @@ function schedulePlannerSync(recordKey) {
try {
const record = plannerRecords[recordKey]
if (!record || !hasPlannerContent(record)) {
if (!record) {
if (syncTimers.size === 0) {
syncStatus.value = 'cloud'
syncMessage.value = '클라우드 동기화 연결됨'
@@ -747,6 +747,16 @@ function schedulePlannerSync(recordKey) {
return
}
if (!hasPlannerContent(record)) {
await deletePlannerEntry(authToken.value, recordKey)
if (syncTimers.size === 0) {
syncStatus.value = 'cloud'
syncMessage.value = '클라우드에서 삭제됨'
}
return
}
await savePlannerEntry(authToken.value, recordKey, {
...record,
tasks: record.tasks.map((task) => ({ ...task })),

View File

@@ -49,3 +49,10 @@ export async function savePlannerEntry(token, entryDate, payload) {
},
})
}
export async function deletePlannerEntry(token, entryDate) {
return request(`/api/planner/${entryDate}`, {
method: 'DELETE',
token,
})
}