fullcart
Version:
Add stripe checkout to any website
14 lines (12 loc) • 384 B
text/typescript
import { persistentMap } from '@nanostores/persistent'
import { onSet } from 'nanostores'
import { customerSchema, type Customer } from '../schemas/customerSchema'
export const customer = persistentMap<Customer>('fullcart-customer', { lines: [] },
{
encode: JSON.stringify,
decode: JSON.parse,
}
)
onSet(customer, ({ newValue }) => {
customerSchema.parse(newValue)
})