[fix] backupcheck process
This commit is contained in:
@@ -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})
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user