4 changed files with 33 additions and 28 deletions
@ -1,12 +1,16 @@ |
|||
import { ref, computed } from 'vue' |
|||
import { defineStore } from 'pinia' |
|||
import type { StatusDatagram } from '@/services/socket' |
|||
import { ref, computed } from "vue"; |
|||
import { defineStore } from "pinia"; |
|||
import * as R from "ramda"; |
|||
import type { StatusDatagram } from "@/services/socket"; |
|||
|
|||
export const useStatusStore = defineStore('status', () => { |
|||
const status = ref<StatusDatagram['data']|undefined>() |
|||
const setStatus = (data: StatusDatagram['data']) => { |
|||
status.value = data |
|||
} |
|||
export const useStatusStore = defineStore("status", () => { |
|||
const status = ref<StatusDatagram["data"] | undefined>(); |
|||
const setStatus = (data: StatusDatagram["data"]) => { |
|||
if (!R.equals(status.value, data)) { |
|||
console.log("status: ", data); |
|||
status.value = data; |
|||
} |
|||
}; |
|||
|
|||
return { status, setStatus } |
|||
}) |
|||
return { status, setStatus }; |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue