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

Class UserStore

ui/src/stores/UserStore.ts:19–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17import { HandleError } from "./helpers";
18
19class UserStore extends EventEmitter {
20 client: UserServiceClient;
21
22 constructor() {
23 super();
24 this.client = new UserServiceClient("");
25 }
26
27 create = (req: CreateUserRequest, callbackFunc: (resp: CreateUserResponse) => void) => {
28 this.client.create(req, SessionStore.getMetadata(), (err, resp) => {
29 if (err !== null) {
30 HandleError(err);
31 return;
32 }
33
34 notification.success({
35 message: "User created",
36 duration: 3,
37 });
38
39 callbackFunc(resp);
40 });
41 };
42
43 get = (req: GetUserRequest, callbackFunc: (resp: GetUserResponse) => void) => {
44 this.client.get(req, SessionStore.getMetadata(), (err, resp) => {
45 if (err !== null) {
46 HandleError(err);
47 return;
48 }
49
50 callbackFunc(resp);
51 });
52 };
53
54 update = (req: UpdateUserRequest, callbackFunc: () => void) => {
55 this.client.update(req, SessionStore.getMetadata(), (err, resp) => {
56 if (err !== null) {
57 HandleError(err);
58 return;
59 }
60
61 notification.success({
62 message: "User updated",
63 duration: 3,
64 });
65
66 callbackFunc();
67 });
68 };
69
70 delete = (req: DeleteUserRequest, callbackFunc: () => void) => {
71 this.client.delete(req, SessionStore.getMetadata(), (err, resp) => {
72 if (err !== null) {
73 HandleError(err);
74 return;
75 }
76

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