Skip to content

Instantly share code, notes, and snippets.

@kazuooooo
Created February 5, 2022 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuooooo/c4f234e7fec21951de68f55ba195759c to your computer and use it in GitHub Desktop.
Save kazuooooo/c4f234e7fec21951de68f55ba195759c to your computer and use it in GitHub Desktop.
export const useExampleStore = defineStore('expamle', {
state: {/*...*/}
actions: {
async setup() {
// ...
//🌟 Sync Pinia's state and Firestore document
onSnapshot(docRef, (ds) => {
if (ds.exists()) {
this.$patch({ docData: ds.data() })
}
})
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment