From 9edefcbcc212bbfbf77a2285fab1bbf759dc9e1a Mon Sep 17 00:00:00 2001
From: Daniel Kelly <me@danielkelly.io>
Date: Mon, 7 Feb 2022 19:34:26 -0600
Subject: [PATCH] add snippet for pinia store

---
 README.md                      |  6 ++++++
 package.json                   |  8 ++++++++
 snippets/vue-script-pinia.json | 24 ++++++++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 snippets/vue-script-pinia.json

diff --git a/README.md b/README.md
index f440a8f..9e48152 100644
--- a/README.md
+++ b/README.md
@@ -141,6 +141,12 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set
 | `vstore-import` | Import vuex store into main.js |
 | `vstore2`       | Updated Base for Vuex store    |
 
+### Pinia
+
+| Snippet         | Purpose                        |
+| --------------- | ------------------------------ |
+| `v-pinia-store` | Base for Pinia store           |
+
 ### Vue Router
 
 | Snippet              | Purpose                                       |
diff --git a/package.json b/package.json
index c5d44d3..8c6d49f 100644
--- a/package.json
+++ b/package.json
@@ -52,6 +52,10 @@
         "language": "javascript",
         "path": "./snippets/vue-script-vuex.json"
       },
+      {
+        "language": "javascript",
+        "path": "./snippets/vue-script-pinia.json"
+      },
       {
         "language": "javascript",
         "path": "./snippets/vue-script-router.json"
@@ -72,6 +76,10 @@
         "language": "typescript",
         "path": "./snippets/vue-script-vuex.json"
       },
+      {
+        "language": "typescript",
+        "path": "./snippets/vue-script-pinia.json"
+      },
       {
         "language": "typescript",
         "path": "./snippets/vue-script-router.json"
diff --git a/snippets/vue-script-pinia.json b/snippets/vue-script-pinia.json
new file mode 100644
index 0000000..d3cd4f8
--- /dev/null
+++ b/snippets/vue-script-pinia.json
@@ -0,0 +1,24 @@
+{
+  "Pinia Store Boilerplate": {
+		"prefix": "v-pinia-store",
+		"body": [
+			"import { defineStore, acceptHMRUpdate } from \"pinia\";",
+      "",
+      "export const use$TM_FILENAME_BASE = defineStore(\"$TM_FILENAME_BASE\", {",
+      "  state: () => {",
+      "    return {",
+      "      $0",
+      "    };",
+      "  },",
+      "  getters: {},",
+      "  actions: {},",
+			"});",
+      "",
+      "if (import.meta.hot) {",
+      "  import.meta.hot.accept(acceptHMRUpdate(use$TM_FILENAME_BASE, import.meta.hot));",
+      "}",
+      ""
+		],
+		"description": "Bootstrap the code needed for a Vue.js Pinia store file"
+	}
+}
\ No newline at end of file