Created
February 5, 2022 15:09
-
-
Save kazuooooo/c4f234e7fec21951de68f55ba195759c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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