underbbs/frontend/ts/doer.ts

16 lines
No EOL
420 B
TypeScript

import util from './util';
export class Doer {
private _reqFn: (doParams: any) => Promise<Response>;
constructor(gateway: string, adapter: string) {
this._reqFn = (doParams: any) => {
let url = `${gateway}/api/adapters/${adapter}/do`;
return util.authorizedFetch("POST", url, JSON.stringify(doParams));
}
}
do(doParams: any): Promise<Response> {
return this._reqFn(doParams);
}
}