You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { ISprinklersDevice, IUser } from "@common/httpApi";
|
|
|
|
import { action, observable } from "mobx";
|
|
|
|
|
|
|
|
export class UserStore {
|
|
|
|
@observable userData: IUser | null = null;
|
|
|
|
|
|
|
|
@action
|
|
|
|
receiveUserData(userData: IUser) {
|
|
|
|
this.userData = userData;
|
|
|
|
}
|
|
|
|
|
|
|
|
findDevice(id: number): ISprinklersDevice | null {
|
|
|
|
return this.userData &&
|
|
|
|
this.userData.devices &&
|
|
|
|
this.userData.devices.find((dev) => dev.id === id) || null;
|
|
|
|
}
|
|
|
|
}
|