js: support payload-less requests
This commit is contained in:
parent
ac6ae94c93
commit
6596ea0bab
1 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,7 @@ import invariant from 'tiny-invariant';
|
|||
type Operation = {
|
||||
path: string;
|
||||
method: string;
|
||||
payload: unknown;
|
||||
payload?: unknown;
|
||||
resolve: (value: unknown) => void;
|
||||
reject: () => void;
|
||||
};
|
||||
|
@ -45,7 +45,8 @@ export class OperationsQueue {
|
|||
const url = `${this.baseUrl}${path}`;
|
||||
|
||||
try {
|
||||
const data = await httpRequest(url, { method, json: payload }).json();
|
||||
const json = payload;
|
||||
const data = await httpRequest(url, { method, json }).json();
|
||||
resolve(data);
|
||||
} catch (e) {
|
||||
handleError(e as ResponseError, reject);
|
||||
|
|
Loading…
Reference in a new issue