MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / GatewayStore

Class GatewayStore

ui/src/stores/GatewayStore.ts:29–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

HandleErrorFunction · 0.90
createMethod · 0.45
getMethod · 0.45
updateMethod · 0.45
deleteMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected