v0.1.14 - 서버 삭제 동기화 추가
This commit is contained in:
14
src/App.vue
14
src/App.vue
@@ -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 })),
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user