| 26 | import { HandleError } from "./helpers"; |
| 27 | |
| 28 | class MulticastGroupStore extends EventEmitter { |
| 29 | client: MulticastGroupServiceClient; |
| 30 | |
| 31 | constructor() { |
| 32 | super(); |
| 33 | this.client = new MulticastGroupServiceClient(""); |
| 34 | } |
| 35 | |
| 36 | create = (req: CreateMulticastGroupRequest, callbackFunc: (resp: CreateMulticastGroupResponse) => void) => { |
| 37 | this.client.create(req, SessionStore.getMetadata(), (err, resp) => { |
| 38 | if (err !== null) { |
| 39 | HandleError(err); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | notification.success({ |
| 44 | message: "Multicast-group created", |
| 45 | duration: 3, |
| 46 | }); |
| 47 | |
| 48 | callbackFunc(resp); |
| 49 | }); |
| 50 | }; |
| 51 | |
| 52 | get = (req: GetMulticastGroupRequest, callbackFunc: (resp: GetMulticastGroupResponse) => void) => { |
| 53 | this.client.get(req, SessionStore.getMetadata(), (err, resp) => { |
| 54 | if (err !== null) { |
| 55 | HandleError(err); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | callbackFunc(resp); |
| 60 | }); |
| 61 | }; |
| 62 | |
| 63 | update = (req: UpdateMulticastGroupRequest, callbackFunc: () => void) => { |
| 64 | this.client.update(req, SessionStore.getMetadata(), err => { |
| 65 | if (err !== null) { |
| 66 | HandleError(err); |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | notification.success({ |
| 71 | message: "Multicast-group updated", |
| 72 | duration: 3, |
| 73 | }); |
| 74 | |
| 75 | callbackFunc(); |
| 76 | }); |
| 77 | }; |
| 78 | |
| 79 | delete = (req: DeleteMulticastGroupRequest, callbackFunc: () => void) => { |
| 80 | this.client.delete(req, SessionStore.getMetadata(), err => { |
| 81 | if (err !== null) { |
| 82 | HandleError(err); |
| 83 | return; |
| 84 | } |
| 85 | |