Commit f7135db6 authored by mercury233's avatar mercury233

add timeout for loading apps.json

parent 0c6ffd91
......@@ -84,7 +84,9 @@ export class AppsService {
let appsURL = 'https://api.mycard.moe/apps.json';
let keysURL = 'https://api.mycard.moe/keys';
try {
let data = await this.http.get(appsURL).map((response) => response.json()).toPromise();
let data = await this.http.get(appsURL)
.timeout(5000)
.map((response) => response.json()).toPromise();
let keys_data = await this.http.get(keysURL, {
search: {
user_id: this.loginService.user.email
......@@ -102,6 +104,7 @@ export class AppsService {
console.error(e);
let data = localStorage.getItem('apps_json');
if (data) {
new Notification('MyCard', {body: '读取最新游戏列表失败...'});
this.apps = this.loadAppsList(JSON.parse(data!));
} else {
alert('读取游戏列表失败,可能是网络不通');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment