underbbs/frontend/ts/subscriber.ts

16 lines
423 B
TypeScript
Raw Normal View History

import util from './util';
export class Subscriber {
private _reqFn: (filter: string)=>void;
constructor(gateway: string, adapter: string, target: string | null) {
this._reqFn = (filter: string) => {
let url = `${gateway}/api/adapters/${adapter}/subscribe`
util.authorizedFetch("POST", url, JSON.stringify({filter, target}));
}
}
subscribe(filter: string) {
this._reqFn(filter);
}
}