fix crash on git server being unavalible
This commit is contained in:
parent
959320f060
commit
07a36f99dd
1 changed files with 10 additions and 6 deletions
|
@ -50,13 +50,17 @@ export default class ApiController extends Controller {
|
||||||
if (Date.now() < cacheExpiry) {
|
if (Date.now() < cacheExpiry) {
|
||||||
this.ok(cachedClient);
|
this.ok(cachedClient);
|
||||||
} else {
|
} else {
|
||||||
const response = await fetch(`http://${Config.githost}/tgpholly/t00-multiuser/raw/branch/master/client/Terminal-00-Multiuser.user.js?${Date.now()}`);
|
fetch(`http://${Config.githost}/tgpholly/t00-multiuser/raw/branch/master/client/Terminal-00-Multiuser.user.js?${Date.now()}`)
|
||||||
if (response.status === 200) {
|
.then(async response => {
|
||||||
cachedClient = await response.text();
|
if (response.status === 200) {
|
||||||
return this.ok(cachedClient);
|
cachedClient = await response.text();
|
||||||
} else {
|
return this.ok(cachedClient);
|
||||||
|
} else {
|
||||||
|
return this.badRequest();
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
return this.badRequest();
|
return this.badRequest();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue