1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

fix: return type

This commit is contained in:
sunnylqm 2023-09-06 23:16:42 +08:00
parent b53878c291
commit c6354bbedc
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View File

@ -132,7 +132,7 @@ function assertRelease() {
}
let lastChecking = Date.now();
let lastResult: CheckResult;
let lastResult: CheckResult = {};
export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
assertRelease();
const now = Date.now();
@ -148,7 +148,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
blockUpdate.until * 1000,
).toLocaleString()}"`,
});
return;
return lastResult;
}
report({ type: 'checking' });
let resp;
@ -172,12 +172,13 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
type: 'errorChecking',
message: '无法连接更新服务器,请检查网络连接后重试',
});
return;
return lastResult;
}
await tryBackupEndpoints();
return checkUpdate(APPKEY, true);
}
const result: CheckResult = await resp.json();
lastResult = result;
// @ts-ignore
checkOperation(result.op);
@ -188,7 +189,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
//@ts-ignore
message: result.message,
});
return;
return lastResult;
}
return result;

View File

@ -26,7 +26,8 @@ export interface UpdateAvailableResult {
export type CheckResult =
| ExpiredResult
| UpTodateResult
| UpdateAvailableResult;
| UpdateAvailableResult
| {};
export interface ProgressData {
hash: string;