diagnostic-ui-httpfix

This commit is contained in:
Drew Ansbacher
2021-11-15 16:29:52 -07:00
committed by Aiden McClelland
parent c2513f0dba
commit 7696ec9a13
2 changed files with 7 additions and 4 deletions

View File

@@ -46,6 +46,12 @@ export class HomePage {
problem: 'Storage drive corrupted. This could be the result of data corruption or a physical damage.',
solution: 'It may or may not be possible to re-use this drive by reformatting and recovering from backup. To enter recovery mode, click ENTER RECOVERY MODE below, then follow instructions. No data will be erased during this step.'
}
} else {
this.error = {
code: error.code,
problem: error.message,
solution: 'Please conact support.'
}
}
} catch (e) {
console.error(e)

View File

@@ -12,17 +12,14 @@ export class HttpService {
async rpcRequest<T> (options: RPCOptions): Promise<T> {
const res = await this.httpRequest<RPCResponse<T>>(options)
if (isRpcError(res)) throw new RpcError(res.error)
if (isRpcSuccess(res)) return res.result
}
async httpRequest<T> (body: RPCOptions): Promise<T> {
const url = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/rpc/v1`
return this.http.post(url, body)
.toPromise()
.then((res: any) => res.body)
.toPromise().then(a => a as T)
.catch(e => { throw new HttpError(e) })
}
}