Fixed form creation
This commit is contained in:
7
client/stores/app.js
vendored
7
client/stores/app.js
vendored
@@ -5,6 +5,7 @@ import { nextTick } from 'vue'
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
layout: 'default',
|
||||
navbarHidden: false,
|
||||
|
||||
// App Loader
|
||||
loader: {
|
||||
@@ -17,6 +18,12 @@ export const useAppStore = defineStore('app', {
|
||||
}
|
||||
}),
|
||||
actions: {
|
||||
hideNavbar () {
|
||||
this.navbarHidden = true
|
||||
},
|
||||
showNavbar () {
|
||||
this.navbarHidden = false
|
||||
},
|
||||
setLayout (layout) {
|
||||
this.layout = layout ?? 'default'
|
||||
},
|
||||
|
||||
15
client/stores/forms.js
vendored
15
client/stores/forms.js
vendored
@@ -6,7 +6,7 @@ export const formsEndpoint = '/open/workspaces/{workspaceId}/forms'
|
||||
export const useFormsStore = defineStore('forms', () => {
|
||||
|
||||
const contentStore = useContentStore('slug')
|
||||
contentStore.startLoading()
|
||||
const allLoaded = ref(false)
|
||||
const currentPage = ref(1)
|
||||
|
||||
const load = (workspaceId) => {
|
||||
@@ -23,14 +23,27 @@ export const useFormsStore = defineStore('forms', () => {
|
||||
currentPage.value++
|
||||
load(workspaceId)
|
||||
} else {
|
||||
allLoaded.value = true
|
||||
contentStore.stopLoading()
|
||||
currentPage.value = 1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const allTags = computed(() => {
|
||||
let tags = []
|
||||
contentStore.getAll.value.forEach((form) => {
|
||||
if (form.tags && form.tags.length) {
|
||||
tags = tags.concat(form.tags.split(','))
|
||||
}
|
||||
})
|
||||
return [...new Set(tags)]
|
||||
})
|
||||
|
||||
return {
|
||||
...contentStore,
|
||||
allLoaded,
|
||||
allTags,
|
||||
load
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user