From b4365b5e304bdd2638e1f45c87726c5e09275660 Mon Sep 17 00:00:00 2001
From: Julien Nahum
Date: Mon, 25 Dec 2023 19:57:00 +0100
Subject: [PATCH] Work in progress for form create guess user
---
client/components/global/Modal.vue | 9 +-
.../pages/auth/components/LoginForm.vue | 4 +
.../forms/create/CreateFormBaseModal.vue | 4 +-
client/pages/forms/create/guest.vue | 182 +++++++-----------
4 files changed, 78 insertions(+), 121 deletions(-)
diff --git a/client/components/global/Modal.vue b/client/components/global/Modal.vue
index bdac199..d75780a 100644
--- a/client/components/global/Modal.vue
+++ b/client/components/global/Modal.vue
@@ -90,6 +90,7 @@ const closeOnEscape = (e) => {
onMounted(() => {
if (process.server) return
document.addEventListener('keydown', closeOnEscape)
+ initMotions()
})
onBeforeUnmount(() => {
@@ -160,13 +161,15 @@ const content = ref(null)
const backdropMotion = ref(null)
const contentMotion = ref(null)
-watch(() => props.show, (newVal, oldVal) => {
- if (newVal) {
+const initMotions = () => {
+ if (props.show) {
nextTick(() => {
backdropMotion.value = useMotion(backdrop.value, motionFadeIn)
contentMotion.value = useMotion(content.value, motionSlideBottom)
})
}
-})
+}
+
+watch(() => props.show, initMotions)
diff --git a/client/components/pages/auth/components/LoginForm.vue b/client/components/pages/auth/components/LoginForm.vue
index 9656887..0002564 100644
--- a/client/components/pages/auth/components/LoginForm.vue
+++ b/client/components/pages/auth/components/LoginForm.vue
@@ -61,6 +61,7 @@ export default {
setup () {
return {
authStore: useAuthStore(),
+ formsStore: useFormsStore(),
workspaceStore: useWorkspacesStore()
}
},
@@ -88,6 +89,9 @@ export default {
const workspaces = await fetchAllWorkspaces()
this.workspaceStore.set(workspaces.data.value)
+ // Load forms
+ this.formsStore.loadAll(this.workspaceStore.currentId)
+
// Redirect home.
this.redirect()
},
diff --git a/client/components/pages/forms/create/CreateFormBaseModal.vue b/client/components/pages/forms/create/CreateFormBaseModal.vue
index cfa33b8..48e2e68 100644
--- a/client/components/pages/forms/create/CreateFormBaseModal.vue
+++ b/client/components/pages/forms/create/CreateFormBaseModal.vue
@@ -1,5 +1,5 @@
-
+
-
+