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

Class ApplicationStore

ui/src/stores/ApplicationStore.ts:77–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75import { callback } from "chart.js/helpers";
76
77class ApplicationStore extends EventEmitter {
78 client: ApplicationServiceClient;
79
80 constructor() {
81 super();
82 this.client = new ApplicationServiceClient("");
83 }
84
85 create = (req: CreateApplicationRequest, callbackFunc: (resp: CreateApplicationResponse) => void) => {
86 this.client.create(req, SessionStore.getMetadata(), (err, resp) => {
87 if (err !== null) {
88 HandleError(err);
89 return;
90 }
91
92 notification.success({
93 message: "Application created",
94 duration: 3,
95 });
96
97 callbackFunc(resp);
98 });
99 };
100
101 get = (req: GetApplicationRequest, callbackFunc: (resp: GetApplicationResponse) => void) => {
102 this.client.get(req, SessionStore.getMetadata(), (err, resp) => {
103 if (err !== null) {
104 HandleError(err);
105 return;
106 }
107
108 callbackFunc(resp);
109 });
110 };
111
112 update = (req: UpdateApplicationRequest, callbackFunc: () => void) => {
113 this.client.update(req, SessionStore.getMetadata(), err => {
114 if (err !== null) {
115 HandleError(err);
116 return;
117 }
118
119 this.emit("change");
120
121 notification.success({
122 message: "Application updated",
123 duration: 3,
124 });
125
126 callbackFunc();
127 });
128 };
129
130 delete = (req: DeleteApplicationRequest, callbackFunc: () => void) => {
131 this.client.delete(req, SessionStore.getMetadata(), err => {
132 if (err !== null) {
133 HandleError(err);
134 return;

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