mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 06:19:44 +00:00
diagnostic-ui-httpfix
This commit is contained in:
committed by
Aiden McClelland
parent
c2513f0dba
commit
7696ec9a13
@@ -46,6 +46,12 @@ export class HomePage {
|
|||||||
problem: 'Storage drive corrupted. This could be the result of data corruption or a physical damage.',
|
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.'
|
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) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|||||||
@@ -12,17 +12,14 @@ export class HttpService {
|
|||||||
|
|
||||||
async rpcRequest<T> (options: RPCOptions): Promise<T> {
|
async rpcRequest<T> (options: RPCOptions): Promise<T> {
|
||||||
const res = await this.httpRequest<RPCResponse<T>>(options)
|
const res = await this.httpRequest<RPCResponse<T>>(options)
|
||||||
|
|
||||||
if (isRpcError(res)) throw new RpcError(res.error)
|
if (isRpcError(res)) throw new RpcError(res.error)
|
||||||
|
|
||||||
if (isRpcSuccess(res)) return res.result
|
if (isRpcSuccess(res)) return res.result
|
||||||
}
|
}
|
||||||
|
|
||||||
async httpRequest<T> (body: RPCOptions): Promise<T> {
|
async httpRequest<T> (body: RPCOptions): Promise<T> {
|
||||||
const url = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/rpc/v1`
|
const url = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/rpc/v1`
|
||||||
return this.http.post(url, body)
|
return this.http.post(url, body)
|
||||||
.toPromise()
|
.toPromise().then(a => a as T)
|
||||||
.then((res: any) => res.body)
|
|
||||||
.catch(e => { throw new HttpError(e) })
|
.catch(e => { throw new HttpError(e) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user