diff --git a/client/components/global/Modal.vue b/client/components/global/Modal.vue index 887e077..c075e7c 100644 --- a/client/components/global/Modal.vue +++ b/client/components/global/Modal.vue @@ -20,7 +20,7 @@
-
+
@@ -28,7 +28,7 @@
-

diff --git a/client/components/global/Navbar.vue b/client/components/global/Navbar.vue index af37c53..b6f64e0 100644 --- a/client/components/global/Navbar.vue +++ b/client/components/global/Navbar.vue @@ -72,7 +72,7 @@ My Forms - @@ -81,7 +81,7 @@ My Templates - 0) { window.scroll({ diff --git a/client/components/open/forms/components/templates/FormTemplateModal.vue b/client/components/open/forms/components/templates/FormTemplateModal.vue index 65a87a5..cb723c7 100644 --- a/client/components/open/forms/components/templates/FormTemplateModal.vue +++ b/client/components/open/forms/components/templates/FormTemplateModal.vue @@ -161,7 +161,7 @@ export default { if (response.data.message) { this.alertSuccess(response.data.message) } - this.templatesStore.addOrUpdate(response.data.data) + this.templatesStore.save(response.data.data) this.$emit('close') }) }, @@ -171,7 +171,7 @@ export default { if (response.data.message) { this.alertSuccess(response.data.message) } - this.templatesStore.addOrUpdate(response.data.data) + this.templatesStore.save(response.data.data) this.$emit('close') }) }, diff --git a/client/components/pages/auth/components/LoginForm.vue b/client/components/pages/auth/components/LoginForm.vue index a5343d8..0aee462 100644 --- a/client/components/pages/auth/components/LoginForm.vue +++ b/client/components/pages/auth/components/LoginForm.vue @@ -42,6 +42,7 @@

{{ cleanQuotes(template.short_description) }}

- @@ -46,8 +46,7 @@ export default { props: { template: { - type: Object, - required: true + type: Object } }, diff --git a/client/components/pages/templates/TemplateTags.vue b/client/components/pages/templates/TemplateTags.vue index 2107010..6ed0b3a 100644 --- a/client/components/pages/templates/TemplateTags.vue +++ b/client/components/pages/templates/TemplateTags.vue @@ -1,42 +1,42 @@ @@ -46,8 +46,8 @@ import { useTemplatesStore } from '../../../stores/templates' export default { props: { - slug: { - type: String, + template: { + type: Object, required: true }, displayAll: { @@ -66,19 +66,17 @@ export default { data: () => ({}), computed: { - template () { - return this.templatesStore.getBySlug(this.slug) - }, - types () { - if (!this.template) return null - console.log('template in types',this.template) - return this.templatesStore.getTemplateTypes(this.template.types) - }, - industries () { - if (!this.template) return null - console.log('template in types',this.template) - return this.templatesStore.getTemplateIndustries(this.template.industries) - } + // template () { + // return this.templatesStore.getByKey(this.slug) + // }, + // types () { + // if (!this.template) return null + // return this.templatesStore.getTemplateTypes(this.template.types) + // }, + // industries () { + // if (!this.template) return null + // return this.templatesStore.getTemplateIndustries(this.template.industries) + // } }, methods: {} diff --git a/client/components/pages/templates/TemplatesList.vue b/client/components/pages/templates/TemplatesList.vue index 749c829..d8aa688 100644 --- a/client/components/pages/templates/TemplatesList.vue +++ b/client/components/pages/templates/TemplatesList.vue @@ -20,7 +20,7 @@

-
+

@@ -83,15 +83,6 @@ import Form from 'vform' import Fuse from 'fuse.js' import SingleTemplate from './SingleTemplate.vue' -// const loadTemplates = function (onlyMy) { -// const templatesStore = useTemplatesStore() -// if(onlyMy){ -// templatesStore.loadAll({'onlymy':true}) -// } else { -// templatesStore.loadIfEmpty() -// } -// } - export default { name: 'TemplatesList', components: {SingleTemplate}, diff --git a/client/composables/lib/vForm/Form.js b/client/composables/lib/vForm/Form.js index 73c6224..c2c693b 100644 --- a/client/composables/lib/vForm/Form.js +++ b/client/composables/lib/vForm/Form.js @@ -1,6 +1,7 @@ import {serialize} from 'object-to-formdata'; import Errors from './Errors'; import cloneDeep from 'clone-deep'; +import {opnFetch} from "~/composables/useOpnApi.js"; function hasFiles(data) { return data instanceof File || data instanceof Blob || @@ -120,18 +121,14 @@ class Form { config.transformRequest = [data => serialize(data)]; } } - return new Promise((resolve, reject) => { - useOpnApi(config.url, config) - .then(({data, error}) => { - if (error.value) { - this.handleErrors(error); - reject(error); - return; - } - + opnFetch(config.url, config) + .then((data) => { this.finishProcessing(); - resolve(data.value); + resolve(data); + }).catch((error) => { + this.handleErrors(error); + resolve(error) }) }); } @@ -139,8 +136,8 @@ class Form { handleErrors(error) { this.busy = false; - if (error.value) { - this.errors.set(this.extractErrors(error.value.data)); + if (error) { + this.errors.set(this.extractErrors(error.data)); } } diff --git a/client/composables/stores/useContentStore.js b/client/composables/stores/useContentStore.js new file mode 100644 index 0000000..ac81046 --- /dev/null +++ b/client/composables/stores/useContentStore.js @@ -0,0 +1,64 @@ + +// Composable with all the logic to encapsulate a default content store + +export const useContentStore = (mapKey = 'id') => { + + const content = ref(new Map()) + const loading = ref(false) + + // Computed + const getAll = computed(() => { + return [...content.value.values()] + }) + const getByKey = (key) => { + if (Array.isArray(key)) { + return key.map((k) => content.value.get(k)).filter((item) => item !== undefined) + } + return content.value.get(key) + } + + // Actions + function set(items) { + content.value = new Map + items.forEach((item) => { + content.value.set(item[mapKey], item) + }) + } + + function save(items) { + if (!Array.isArray(items)) items = [items] + items.forEach((item) => { + content.value.set(item[mapKey], item) + }) + } + + function remove(item) { + content.value.remove(item[mapKey]) + } + + function startLoading() { + loading.value = true + } + + function stopLoading() { + loading.value = false + } + + function resetState() { + set([]) + stopLoading() + } + + return { + content, + loading, + getAll, + getByKey, + set, + save, + remove, + startLoading, + stopLoading, + resetState + } +} diff --git a/client/composables/useOpnApi.js b/client/composables/useOpnApi.js index 6400401..412b541 100644 --- a/client/composables/useOpnApi.js +++ b/client/composables/useOpnApi.js @@ -44,6 +44,10 @@ export function getOpnRequestsOptions(request, opts) { } } +export const opnFetch = (request, opts = {}) => { + return $fetch(request, getOpnRequestsOptions(request, opts)) +} + export const useOpnApi = (request, opts = {}) => { return useFetch(request, getOpnRequestsOptions(request, opts)) } diff --git a/client/middleware/01.check-auth.global.js b/client/middleware/01.check-auth.global.js index 3b23faa..4bd9a23 100644 --- a/client/middleware/01.check-auth.global.js +++ b/client/middleware/01.check-auth.global.js @@ -1,3 +1,5 @@ +import {useWorkspacesStore} from "~/stores/workspaces.js"; + export default defineNuxtRouteMiddleware(async(to, from) => { const authStore = useAuthStore() authStore.initStore(useCookie('token').value, useCookie('admin_token').value) diff --git a/client/package-lock.json b/client/package-lock.json index 9c8bca5..c42eac2 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -24,6 +24,7 @@ "js-sha256": "^0.9.0", "libphonenumber-js": "^1.10.44", "object-to-formdata": "^4.5.1", + "pinia": "^2.1.7", "prismjs": "^1.24.1", "qrcode": "^1.5.1", "query-builder-vue-3": "^1.0.1", @@ -2549,56 +2550,6 @@ "url": "https://github.com/sponsors/posva" } }, - "node_modules/@pinia/nuxt/node_modules/pinia": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz", - "integrity": "sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": ">=0.14.5" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.3.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/@pinia/nuxt/node_modules/vue-demi": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", - "integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -2828,9 +2779,9 @@ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.0.tgz", - "integrity": "sha512-+1ge/xmaJpm1KVBuIH38Z94zj9fBD+hp+/5WLaHgyY8XLq1ibxk/zj6dTXaqM2cAbYKq8jYlhHd6k05If1W5xA==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.1.tgz", + "integrity": "sha512-6vMdBZqtq1dVQ4CWdhFwhKZL6E4L1dV6jUjuBvsavvNJSppzi6dLBbuV+3+IyUREaj9ZFvQefnQm28v4OCXlig==", "cpu": [ "arm" ], @@ -2840,9 +2791,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.0.tgz", - "integrity": "sha512-im6hUEyQ7ZfoZdNvtwgEJvBWZYauC9KVKq1w58LG2Zfz6zMd8gRrbN+xCVoqA2hv/v6fm9lp5LFGJ3za8EQH3A==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.1.tgz", + "integrity": "sha512-Jto9Fl3YQ9OLsTDWtLFPtaIMSL2kwGyGoVCmPC8Gxvym9TCZm4Sie+cVeblPO66YZsYH8MhBKDMGZ2NDxuk/XQ==", "cpu": [ "arm64" ], @@ -2852,9 +2803,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.0.tgz", - "integrity": "sha512-u7aTMskN6Dmg1lCT0QJ+tINRt+ntUrvVkhbPfFz4bCwRZvjItx2nJtwJnJRlKMMaQCHRjrNqHRDYvE4mBm3DlQ==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.1.tgz", + "integrity": "sha512-LtYcLNM+bhsaKAIGwVkh5IOWhaZhjTfNOkGzGqdHvhiCUVuJDalvDxEdSnhFzAn+g23wgsycmZk1vbnaibZwwA==", "cpu": [ "arm64" ], @@ -2864,9 +2815,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.0.tgz", - "integrity": "sha512-8FvEl3w2ExmpcOmX5RJD0yqXcVSOqAJJUJ29Lca29Ik+3zPS1yFimr2fr5JSZ4Z5gt8/d7WqycpgkX9nocijSw==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.1.tgz", + "integrity": "sha512-KyP/byeXu9V+etKO6Lw3E4tW4QdcnzDG/ake031mg42lob5tN+5qfr+lkcT/SGZaH2PdW4Z1NX9GHEkZ8xV7og==", "cpu": [ "x64" ], @@ -2876,9 +2827,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.0.tgz", - "integrity": "sha512-lHoKYaRwd4gge+IpqJHCY+8Vc3hhdJfU6ukFnnrJasEBUvVlydP8PuwndbWfGkdgSvZhHfSEw6urrlBj0TSSfg==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.1.tgz", + "integrity": "sha512-Yqz/Doumf3QTKplwGNrCHe/B2p9xqDghBZSlAY0/hU6ikuDVQuOUIpDP/YcmoT+447tsZTmirmjgG3znvSCR0Q==", "cpu": [ "arm" ], @@ -2888,9 +2839,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.0.tgz", - "integrity": "sha512-JbEPfhndYeWHfOSeh4DOFvNXrj7ls9S/2omijVsao+LBPTPayT1uKcK3dHW3MwDJ7KO11t9m2cVTqXnTKpeaiw==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.1.tgz", + "integrity": "sha512-u3XkZVvxcvlAOlQJ3UsD1rFvLWqu4Ef/Ggl40WAVCuogf4S1nJPHh5RTgqYFpCOvuGJ7H5yGHabjFKEZGExk5Q==", "cpu": [ "arm64" ], @@ -2900,9 +2851,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.0.tgz", - "integrity": "sha512-ahqcSXLlcV2XUBM3/f/C6cRoh7NxYA/W7Yzuv4bDU1YscTFw7ay4LmD7l6OS8EMhTNvcrWGkEettL1Bhjf+B+w==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.1.tgz", + "integrity": "sha512-0XSYN/rfWShW+i+qjZ0phc6vZ7UWI8XWNz4E/l+6edFt+FxoEghrJHjX1EY/kcUGCnZzYYRCl31SNdfOi450Aw==", "cpu": [ "arm64" ], @@ -2912,9 +2863,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.0.tgz", - "integrity": "sha512-uwvOYNtLw8gVtrExKhdFsYHA/kotURUmZYlinH2VcQxNCQJeJXnkmWgw2hI9Xgzhgu7J9QvWiq9TtTVwWMDa+w==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.1.tgz", + "integrity": "sha512-LmYIO65oZVfFt9t6cpYkbC4d5lKHLYv5B4CSHRpnANq0VZUQXGcCPXHzbCXCz4RQnx7jvlYB1ISVNCE/omz5cw==", "cpu": [ "riscv64" ], @@ -2924,9 +2875,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.0.tgz", - "integrity": "sha512-m6pkSwcZZD2LCFHZX/zW2aLIISyzWLU3hrLLzQKMI12+OLEzgruTovAxY5sCZJkipklaZqPy/2bEEBNjp+Y7xg==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.1.tgz", + "integrity": "sha512-kr8rEPQ6ns/Lmr/hiw8sEVj9aa07gh1/tQF2Y5HrNCCEPiCBGnBUt9tVusrcBBiJfIt1yNaXN6r1CCmpbFEDpg==", "cpu": [ "x64" ], @@ -2936,9 +2887,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.0.tgz", - "integrity": "sha512-VFAC1RDRSbU3iOF98X42KaVicAfKf0m0OvIu8dbnqhTe26Kh6Ym9JrDulz7Hbk7/9zGc41JkV02g+p3BivOdAg==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.1.tgz", + "integrity": "sha512-t4QSR7gN+OEZLG0MiCgPqMWZGwmeHhsM4AkegJ0Kiy6TnJ9vZ8dEIwHw1LcZKhbHxTY32hp9eVCMdR3/I8MGRw==", "cpu": [ "x64" ], @@ -2948,9 +2899,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.0.tgz", - "integrity": "sha512-9jPgMvTKXARz4inw6jezMLA2ihDBvgIU9Ml01hjdVpOcMKyxFBJrn83KVQINnbeqDv0+HdO1c09hgZ8N0s820Q==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.1.tgz", + "integrity": "sha512-7XI4ZCBN34cb+BH557FJPmh0kmNz2c25SCQeT9OiFWEgf8+dL6ZwJ8f9RnUIit+j01u07Yvrsuu1rZGxJCc51g==", "cpu": [ "arm64" ], @@ -2960,9 +2911,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.0.tgz", - "integrity": "sha512-WE4pT2kTXQN2bAv40Uog0AsV7/s9nT9HBWXAou8+++MBCnY51QS02KYtm6dQxxosKi1VIz/wZIrTQO5UP2EW+Q==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.1.tgz", + "integrity": "sha512-yE5c2j1lSWOH5jp+Q0qNL3Mdhr8WuqCNVjc6BxbVfS5cAS6zRmdiw7ktb8GNpDCEUJphILY6KACoFoRtKoqNQg==", "cpu": [ "ia32" ], @@ -2972,9 +2923,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.0.tgz", - "integrity": "sha512-aPP5Q5AqNGuT0tnuEkK/g4mnt3ZhheiXrDIiSVIHN9mcN21OyXDVbEMqmXPE7e2OplNLDkcvV+ZoGJa2ZImFgw==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.1.tgz", + "integrity": "sha512-PyJsSsafjmIhVgaI1Zdj7m8BB8mMckFah/xbpplObyHfiXzKcI5UOUXRyOdHW7nz4DpMCuzLnF7v5IWHenCwYA==", "cpu": [ "x64" ], @@ -3227,9 +3178,9 @@ } }, "node_modules/@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", "dependencies": { "undici-types": "~5.26.4" } @@ -6732,9 +6683,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.51", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.51.tgz", - "integrity": "sha512-vY2I+rQwrDQzoPds0JeTEpeWzbUJgqoV0O4v31PauHBb/e+1KCXKylHcDnBMgJZ9fH9mErsEbROJY3Z3JtqEmg==" + "version": "1.10.52", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.52.tgz", + "integrity": "sha512-6vCuCHgem+OW1/VCAKgkasfegItCea8zIT7s9/CG/QxdCMIM7GfzbEBG5d7lGO3rzipjt5woOQL3DiHa8Fy78Q==" }, "node_modules/lie": { "version": "3.1.1", @@ -8195,6 +8146,56 @@ "node": ">=0.10.0" } }, + "node_modules/pinia": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz", + "integrity": "sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==", + "dependencies": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.3.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/vue-demi": { + "version": "0.14.6", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", + "integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/pirates": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", @@ -9212,9 +9213,9 @@ } }, "node_modules/rollup": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.0.tgz", - "integrity": "sha512-bUHW/9N21z64gw8s6tP4c88P382Bq/L5uZDowHlHx6s/QWpjJXivIAbEw6LZthgSvlEizZBfLC4OAvWe7aoF7A==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.1.tgz", + "integrity": "sha512-pgPO9DWzLoW/vIhlSoDByCzcpX92bKEorbgXuZrqxByte3JFk2xSW2JEeAcyLc9Ru9pqcNNW+Ob7ntsk2oT/Xw==", "bin": { "rollup": "dist/bin/rollup" }, @@ -9223,19 +9224,19 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.9.0", - "@rollup/rollup-android-arm64": "4.9.0", - "@rollup/rollup-darwin-arm64": "4.9.0", - "@rollup/rollup-darwin-x64": "4.9.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.9.0", - "@rollup/rollup-linux-arm64-gnu": "4.9.0", - "@rollup/rollup-linux-arm64-musl": "4.9.0", - "@rollup/rollup-linux-riscv64-gnu": "4.9.0", - "@rollup/rollup-linux-x64-gnu": "4.9.0", - "@rollup/rollup-linux-x64-musl": "4.9.0", - "@rollup/rollup-win32-arm64-msvc": "4.9.0", - "@rollup/rollup-win32-ia32-msvc": "4.9.0", - "@rollup/rollup-win32-x64-msvc": "4.9.0", + "@rollup/rollup-android-arm-eabi": "4.9.1", + "@rollup/rollup-android-arm64": "4.9.1", + "@rollup/rollup-darwin-arm64": "4.9.1", + "@rollup/rollup-darwin-x64": "4.9.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.1", + "@rollup/rollup-linux-arm64-gnu": "4.9.1", + "@rollup/rollup-linux-arm64-musl": "4.9.1", + "@rollup/rollup-linux-riscv64-gnu": "4.9.1", + "@rollup/rollup-linux-x64-gnu": "4.9.1", + "@rollup/rollup-linux-x64-musl": "4.9.1", + "@rollup/rollup-win32-arm64-msvc": "4.9.1", + "@rollup/rollup-win32-ia32-msvc": "4.9.1", + "@rollup/rollup-win32-x64-msvc": "4.9.1", "fsevents": "~2.3.2" } }, diff --git a/client/package.json b/client/package.json index 051d7d8..2512e43 100644 --- a/client/package.json +++ b/client/package.json @@ -36,6 +36,7 @@ "js-sha256": "^0.9.0", "libphonenumber-js": "^1.10.44", "object-to-formdata": "^4.5.1", + "pinia": "^2.1.7", "prismjs": "^1.24.1", "qrcode": "^1.5.1", "query-builder-vue-3": "^1.0.1", diff --git a/client/pages/forms/create.vue b/client/pages/forms/create.vue index a8f945d..509f659 100644 --- a/client/pages/forms/create.vue +++ b/client/pages/forms/create.vue @@ -121,7 +121,7 @@ export default { this.initForm() this.formInitialHash = this.hashString(JSON.stringify(this.form.data())) if (this.$route.query.template !== undefined && this.$route.query.template) { - const template = this.templatesStore.getBySlug(this.$route.query.template) + const template = this.templatesStore.getByKey(this.$route.query.template) if (template && template.structure) { this.form = new Form({ ...this.form.data(), ...template.structure }) } diff --git a/client/pages/forms/create/guest.vue b/client/pages/forms/create/guest.vue index cad5544..e1d003f 100644 --- a/client/pages/forms/create/guest.vue +++ b/client/pages/forms/create/guest.vue @@ -116,7 +116,7 @@ export default { this.initForm() if (this.$route.query.template !== undefined && this.$route.query.template) { - const template = this.templatesStore.getBySlug(this.$route.query.template) + const template = this.templatesStore.getByKey(this.$route.query.template) if (template && template.structure) { this.form = new Form({ ...this.form.data(), ...template.structure }) } diff --git a/client/pages/home.vue b/client/pages/home.vue index d77b942..08d7291 100644 --- a/client/pages/home.vue +++ b/client/pages/home.vue @@ -126,10 +126,8 @@ const loadForms = function () { const formsStore = useFormsStore() const workspacesStore = useWorkspacesStore() formsStore.startLoading() - return workspacesStore.loadIfEmpty().then(() => { - if (process.client) { - formsStore.loadIfEmpty(workspacesStore.currentId) - } + workspacesStore.loadIfEmpty().then(() => { + formsStore.loadIfEmpty(workspacesStore.currentId) }) } diff --git a/client/pages/templates/[slug].vue b/client/pages/templates/[slug].vue index 0f43c85..911eca7 100644 --- a/client/pages/templates/[slug].vue +++ b/client/pages/templates/[slug].vue @@ -1,14 +1,14 @@