(obj: any)
| 4 | import { db } from './db'; |
| 5 | |
| 6 | export const encode = (obj: any) => { |
| 7 | const btoa = |
| 8 | typeof window === 'undefined' |
| 9 | ? (str: string) => Buffer.from(str, 'binary').toString('base64') |
| 10 | : window.btoa; |
| 11 | return btoa(JSON.stringify(obj)); |
| 12 | }; |
| 13 | |
| 14 | export const decode = (str: string) => { |
| 15 | const atob = |