19 lines
376 B
TypeScript
19 lines
376 B
TypeScript
import type { Client } from '#shared/types'
|
|
import { createGlobalState, useLocalStorage } from '@vueuse/core'
|
|
|
|
export const useGlobalState = createGlobalState(() => {
|
|
const username = useLocalStorage<string>('username', '')
|
|
|
|
const clients = shallowRef<Client[]>([])
|
|
|
|
function reset() {
|
|
clients.value = []
|
|
}
|
|
|
|
return {
|
|
username,
|
|
clients,
|
|
reset,
|
|
}
|
|
})
|