Fixed most of the form/show pages

This commit is contained in:
Julien Nahum
2023-12-20 18:38:43 +01:00
parent af5656ce81
commit bab8517879
19 changed files with 317 additions and 335 deletions

View File

@@ -9,7 +9,7 @@ export const useFormsStore = defineStore('forms', () => {
const allLoaded = ref(false)
const currentPage = ref(1)
const load = (workspaceId) => {
const loadAll = (workspaceId) => {
contentStore.startLoading()
return opnFetch(formsEndpoint.replace('{workspaceId}', workspaceId),{query: {page: currentPage.value}})
.then((response) => {
@@ -21,7 +21,7 @@ export const useFormsStore = defineStore('forms', () => {
}
if (currentPage.value < response.meta.last_page) {
currentPage.value++
load(workspaceId)
loadAll(workspaceId)
} else {
allLoaded.value = true
contentStore.stopLoading()
@@ -30,6 +30,14 @@ export const useFormsStore = defineStore('forms', () => {
})
}
const load = (workspaceId, slug) => {
contentStore.startLoading()
return opnFetch(formsEndpoint.replace('{workspaceId}', workspaceId) + '/' + slug)
.then((response) => {
console.log(response.data.value)
})
}
const allTags = computed(() => {
let tags = []
contentStore.getAll.value.forEach((form) => {
@@ -44,6 +52,7 @@ export const useFormsStore = defineStore('forms', () => {
...contentStore,
allLoaded,
allTags,
loadAll,
load
}
})