init: Init React Application
This commit is contained in:
28
src/shared/store/DevicesStore/index.tsx
Normal file
28
src/shared/store/DevicesStore/index.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import { API_URL, authInstance } from "@shared";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
class DevicesStore {
|
||||
devices: any[] = [];
|
||||
uuid: string | null = null;
|
||||
sendSnapshotModalOpen = false;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
getDevices = async () => {
|
||||
const response = await authInstance.get(`${API_URL}/devices/connected`);
|
||||
console.log(response.data);
|
||||
this.devices = response.data;
|
||||
};
|
||||
|
||||
setSelectedDevice = (uuid: string) => {
|
||||
this.uuid = uuid;
|
||||
};
|
||||
|
||||
toggleSendSnapshotModal = () => {
|
||||
this.sendSnapshotModalOpen = !this.sendSnapshotModalOpen;
|
||||
};
|
||||
}
|
||||
|
||||
export const devicesStore = new DevicesStore();
|
Reference in New Issue
Block a user