(data: string)
| 68 | }; |
| 69 | |
| 70 | export const storeDb = async (data: string) => { |
| 71 | // If we are running in a Node.js environment |
| 72 | if (typeof window === 'undefined') { |
| 73 | const { writeFile } = await import('fs/promises'); |
| 74 | await writeFile(dbFilePath, data); |
| 75 | } else { |
| 76 | // If we are running in a browser environment |
| 77 | window.localStorage.setItem('msw-db', data); |
| 78 | } |
| 79 | }; |
| 80 | |
| 81 | export const persistDb = async (model: Model) => { |
| 82 | if (process.env.NODE_ENV === 'test') return; |