[fix] backupcheck process

This commit is contained in:
kwaroran
2023-12-28 23:11:34 +09:00
parent 922eb65fdf
commit 00c8ab0204
2 changed files with 14 additions and 4 deletions

View File

@@ -81,8 +81,8 @@ export async function SaveLocalBackup(){
return return
} }
//check backup data //check backup data is corrupted
fetch(hubURL + '/backupcheck', { const corrupted = await fetch(hubURL + '/backupcheck', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -90,6 +90,11 @@ export async function SaveLocalBackup(){
body: JSON.stringify(get(DataBase)), body: JSON.stringify(get(DataBase)),
mode: 'no-cors' mode: 'no-cors'
}) })
if(corrupted.status === 400){
alertError('Failed, Backup data is corrupted')
return
}
if(isTauri){ if(isTauri){
const assets = await readDir('assets', {dir: BaseDirectory.AppData}) const assets = await readDir('assets', {dir: BaseDirectory.AppData})

View File

@@ -202,7 +202,8 @@ async function backupDrive(ACCESS_TOKEN:string) {
msg: "Uploading Backup..." msg: "Uploading Backup..."
}) })
fetch(hubURL + '/backupcheck', { //check backup data is corrupted
const corrupted = await fetch(hubURL + '/backupcheck', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -210,6 +211,10 @@ async function backupDrive(ACCESS_TOKEN:string) {
body: JSON.stringify(get(DataBase)), body: JSON.stringify(get(DataBase)),
mode: 'no-cors' mode: 'no-cors'
}) })
if(corrupted.status === 400){
alertError('Failed, Backup data is corrupted')
return
}
const files:DriveFile[] = await getFilesInFolder(ACCESS_TOKEN) const files:DriveFile[] = await getFilesInFolder(ACCESS_TOKEN)