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

View File

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