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

Class DeviceStore

ui/src/stores/DeviceStore.ts:38–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36import { HandleError } from "./helpers";
37
38class DeviceStore extends EventEmitter {
39 client: DeviceServiceClient;
40
41 constructor() {
42 super();
43 this.client = new DeviceServiceClient("");
44 }
45
46 create = (req: CreateDeviceRequest, callbackFunc: () => void) => {
47 this.client.create(req, SessionStore.getMetadata(), err => {
48 if (err !== null) {
49 HandleError(err);
50 return;
51 }
52
53 notification.success({
54 message: "Device created",
55 duration: 3,
56 });
57
58 callbackFunc();
59 });
60 };
61
62 get = (req: GetDeviceRequest, callbackFunc: (resp: GetDeviceResponse) => void) => {
63 this.client.get(req, SessionStore.getMetadata(), (err, resp) => {
64 if (err !== null) {
65 HandleError(err);
66 return;
67 }
68
69 callbackFunc(resp);
70 });
71 };
72
73 update = (req: UpdateDeviceRequest, callbackFunc: () => void) => {
74 this.client.update(req, SessionStore.getMetadata(), err => {
75 if (err !== null) {
76 HandleError(err);
77 return;
78 }
79
80 this.emit("change");
81
82 notification.success({
83 message: "Device updated",
84 duration: 3,
85 });
86
87 callbackFunc();
88 });
89 };
90
91 delete = (req: DeleteDeviceRequest, callbackFunc: () => void) => {
92 this.client.delete(req, SessionStore.getMetadata(), err => {
93 if (err !== null) {
94 HandleError(err);
95 return;

Callers

nothing calls this directly

Calls 8

HandleErrorFunction · 0.90
activateMethod · 0.80
createMethod · 0.45
getMethod · 0.45
updateMethod · 0.45
deleteMethod · 0.45
listMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected