19 lines
511 B
TypeScript
19 lines
511 B
TypeScript
import { emptyCustomerProfile, type CustomerProfileVault } from '~/types/customer-profile'
|
|
import { useLocalStorageRef } from '~/utils/useLocalStorageRef'
|
|
|
|
const KEY = 'policy-ui-customer-profile-vault-v1'
|
|
|
|
export function useCustomerProfileVault() {
|
|
const profile = useLocalStorageRef(KEY, () => emptyCustomerProfile())
|
|
|
|
function touch() {
|
|
profile.value.updatedAt = new Date().toISOString()
|
|
}
|
|
|
|
function reset() {
|
|
profile.value = emptyCustomerProfile()
|
|
}
|
|
|
|
return { profile, touch, reset }
|
|
}
|