28 lines
627 B
TypeScript
28 lines
627 B
TypeScript
import { API_URL, authInstance } from "@shared";
|
|
import { makeAutoObservable } from "mobx";
|
|
|
|
class DevicesStore {
|
|
devices: string[] = [];
|
|
uuid: string | null = null;
|
|
sendSnapshotModalOpen = false;
|
|
|
|
constructor() {
|
|
makeAutoObservable(this);
|
|
}
|
|
|
|
getDevices = async () => {
|
|
const response = await authInstance.get(`${API_URL}/devices/connected`);
|
|
this.devices = response.data;
|
|
};
|
|
|
|
setSelectedDevice = (uuid: string) => {
|
|
this.uuid = uuid;
|
|
};
|
|
|
|
toggleSendSnapshotModal = () => {
|
|
this.sendSnapshotModalOpen = !this.sendSnapshotModalOpen;
|
|
};
|
|
}
|
|
|
|
export const devicesStore = new DevicesStore();
|