File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
8989 const runtimeDir = fileURLToPath ( new URL ( './runtime' , import . meta. url ) )
9090 const templatesDir = fileURLToPath ( new URL ( '../templates' , import . meta. url ) )
9191
92+ // to handle TimeStamp objects
93+ addPlugin ( resolve ( runtimeDir , 'payload-plugin' ) )
94+
9295 // TODO: I don't think the appConfig is the right place to store these as it makes things reactive
9396 // Let plugins and the user access the firebase config within the app
9497 nuxt . options . appConfig . firebaseConfig = markRaw ( options . config )
Original file line number Diff line number Diff line change 1+ import {
2+ definePayloadPlugin ,
3+ definePayloadReducer ,
4+ definePayloadReviver ,
5+ } from '#app'
6+
7+ /**
8+ * Handles Firestore Timestamps and other JSONifiable objects
9+ */
10+ export default definePayloadPlugin ( ( ) => {
11+ definePayloadReducer (
12+ 'JSONifiable' ,
13+ ( data : any ) =>
14+ data != null &&
15+ typeof data . toJSON === 'function' &&
16+ JSON . stringify ( data . toJSON ( ) )
17+ )
18+ definePayloadReviver ( 'JSONifiable' , ( data : string ) => JSON . parse ( data ) )
19+ } )
You can’t perform that action at this time.
0 commit comments