import { ref, Ref} from "vue"; interface UserState { email: string | null; password?: string; key: string | null; } const user:Ref = ref({ email: null, key: "testing" }); const CRIMATA_KEY = "CRIMATA_KEY"; const raw = window.localStorage.getItem(CRIMATA_KEY); if (raw) { user.value = JSON.parse(raw); } export const useAuth = () => { const setUser = (token: UserState) => { window.localStorage.setItem(CRIMATA_KEY, JSON.stringify(token)); user.value = token; } return { setUser, user } }