mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
revamp wifi, fix error messaging in forms
This commit is contained in:
committed by
Aiden McClelland
parent
bcb6d9d673
commit
62b523ebde
@@ -27,11 +27,12 @@ export class HttpService {
|
||||
async rpcRequest<T> (rpcOpts: RPCOptions): Promise<T> {
|
||||
const { url, version } = this.config.api
|
||||
rpcOpts.params = rpcOpts.params || { }
|
||||
const httpOpts = {
|
||||
const httpOpts: HttpOptions = {
|
||||
method: Method.POST,
|
||||
body: rpcOpts,
|
||||
url: `/${url}/${version}`,
|
||||
}
|
||||
if (rpcOpts.timeout) httpOpts.timeout = rpcOpts.timeout
|
||||
|
||||
const res = await this.httpRequest<RPCResponse<T>>(httpOpts)
|
||||
|
||||
@@ -78,6 +79,7 @@ export class HttpService {
|
||||
case Method.PATCH: req = this.http.patch(url, httpOpts.body, options) as any; break
|
||||
case Method.DELETE: req = this.http.delete(url, options) as any; break
|
||||
}
|
||||
console.log('REQUEST', options)
|
||||
|
||||
return (httpOpts.timeout ? withTimeout(req, httpOpts.timeout) : req)
|
||||
.toPromise()
|
||||
@@ -139,6 +141,7 @@ export interface RPCOptions {
|
||||
params?: {
|
||||
[param: string]: string | number | boolean | object | string[] | number[];
|
||||
}
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
interface RPCBase {
|
||||
|
||||
Reference in New Issue
Block a user