MCPcopy Create free account
hub / github.com/gotify/server / ClientStore

Class ClientStore

ui/src/client/ClientStore.ts:8–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import {IClient} from '../types';
7
8export class ClientStore extends BaseStore<IClient> {
9 public constructor(private readonly snack: SnackReporter) {
10 super();
11 }
12
13 protected requestItems = (): Promise<IClient[]> =>
14 axios.get<IClient[]>(`${config.get('url')}client`).then((response) => response.data);
15
16 protected requestDelete(id: number): Promise<void> {
17 return axios
18 .delete(`${config.get('url')}client/${id}`)
19 .then(() => this.snack('Client deleted'));
20 }
21
22 @action
23 public update = async (id: number, name: string): Promise<void> => {
24 await axios.put(`${config.get('url')}client/${id}`, {name});
25 await this.refresh();
26 this.snack('Client updated');
27 };
28
29 @action
30 public createNoNotifcation = async (name: string): Promise<IClient> => {
31 const client = await axios.post(`${config.get('url')}client`, {name});
32 await this.refresh();
33 return client.data;
34 };
35
36 @action
37 public create = async (name: string): Promise<void> => {
38 await this.createNoNotifcation(name);
39 this.snack('Client added');
40 };
41}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…