Set middleware on pages (#278)

* Se middleware on pages

* Se middleware on account page
This commit is contained in:
formsdev 2024-01-05 15:17:36 +05:30 committed by GitHub
parent 2207c8cd90
commit cc7d64a0c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 52 additions and 39 deletions

View File

@ -493,40 +493,21 @@
</div> </div>
</template> </template>
<script> <script setup>
import { computed } from 'vue' import { computed } from 'vue'
import { useAuthStore } from '../stores/auth' import { useAuthStore } from '../stores/auth'
export default { const authStore = useAuthStore()
layout: 'default',
setup () { useOpnSeoMeta({
useOpnSeoMeta({ title: 'Free AI form builder',
title: 'Free AI form builder', description: 'Transform your ideas into fully functional forms with OpnForm AI Builder quick, accurate, and tailored to fit any requirement.'
description: 'Transform your ideas into fully functional forms with OpnForm AI Builder quick, accurate, and tailored to fit any requirement.' })
}) defineRouteRules({
prerender: true
})
const authStore = useAuthStore() let authenticated = computed(() => authStore.check)
defineRouteRules({
prerender: true
})
return {
authenticated : computed(() => authStore.check),
}
},
data: () => ({
}),
mounted() {},
methods: {},
computed: {
configLinks: () => this.$config.links
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -24,9 +24,10 @@
<script> <script>
export default { export default {
middleware: 'guest',
setup () { setup () {
definePageMeta({
middleware: "guest"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Reset Password' title: 'Reset Password'
}) })

View File

@ -34,9 +34,10 @@
<script> <script>
export default { export default {
middleware: 'guest',
setup () { setup () {
definePageMeta({
middleware: "guest"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Reset Password' title: 'Reset Password'
}) })

View File

@ -22,7 +22,6 @@ import {hash} from "~/lib/utils.js";
export default { export default {
name: 'EditForm', name: 'EditForm',
components: { Breadcrumb, FormEditor }, components: { Breadcrumb, FormEditor },
middleware: 'auth',
beforeRouteLeave (to, from, next) { beforeRouteLeave (to, from, next) {
if (this.isDirty()) { if (this.isDirty()) {
@ -55,6 +54,9 @@ export default {
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Edit ' + ((form && form.value) ? form.value.title : 'Your Form') title: 'Edit ' + ((form && form.value) ? form.value.title : 'Your Form')
}) })
definePageMeta({
middleware: "auth"
})
return { return {
formsStore, formsStore,

View File

@ -141,9 +141,10 @@ export default {
FormCleanings FormCleanings
}, },
middleware: 'auth',
setup () { setup () {
definePageMeta({
middleware: "auth"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Home' title: 'Home'
}) })

View File

@ -45,6 +45,9 @@ export default {
}, },
setup (props) { setup (props) {
definePageMeta({
middleware: "auth"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: (props.form) ? 'Share Form - '+props.form.title : 'Share Form' title: (props.form) ? 'Share Form - '+props.form.title : 'Share Form'
}) })

View File

@ -18,6 +18,9 @@ export default {
}, },
setup (props) { setup (props) {
definePageMeta({
middleware: "auth"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: (props.form) ? 'Form Analytics - '+props.form.title : 'Form Analytics' title: (props.form) ? 'Form Analytics - '+props.form.title : 'Form Analytics'
}) })

View File

@ -14,6 +14,9 @@ export default {
}, },
setup (props) { setup (props) {
definePageMeta({
middleware: "auth"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: (props.form) ? 'Form Submissions - '+props.form.title : 'Form Submissions' title: (props.form) ? 'Form Submissions - '+props.form.title : 'Form Submissions'
}) })

View File

@ -51,6 +51,9 @@ const form = storeToRefs(workingFormStore).content
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Create a new Form for free', title: 'Create a new Form for free',
}) })
definePageMeta({
middleware: "guest"
})
// Data // Data
const stateReady = ref(false) const stateReady = ref(false)

View File

@ -76,8 +76,6 @@ export default {
}) })
}, },
middleware: 'guest',
data: () => ({ data: () => ({
}), }),

View File

@ -25,6 +25,9 @@ let loading = false
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Account' title: 'Account'
}) })
definePageMeta({
middleware: "auth"
})
const deleteAccount = () => { const deleteAccount = () => {
loading = true loading = true

View File

@ -27,6 +27,9 @@ import AppSumoBilling from '../../components/vendor/appsumo/AppSumoBilling.vue'
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Billing' title: 'Billing'
}) })
definePageMeta({
middleware: "auth"
})
const authStore = useAuthStore() const authStore = useAuthStore()
let user = computed(() => authStore.user) let user = computed(() => authStore.user)

View File

@ -28,6 +28,9 @@
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Password' title: 'Password'
}) })
definePageMeta({
middleware: "auth"
})
let form = useForm({ let form = useForm({
password: '', password: '',

View File

@ -27,6 +27,9 @@ const user = computed(() => authStore.user)
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Profile' title: 'Profile'
}) })
definePageMeta({
middleware: "auth"
})
let form = useForm({ let form = useForm({
name: '', name: '',

View File

@ -126,6 +126,9 @@ let loading = computed(() => workspacesStore.loading)
useOpnSeoMeta({ useOpnSeoMeta({
title: 'Workspaces' title: 'Workspaces'
}) })
definePageMeta({
middleware: "auth"
})
let form = useForm({ let form = useForm({
name: '', name: '',

View File

@ -22,9 +22,11 @@ import TemplatesList from '../../components/pages/templates/TemplatesList.vue'
export default { export default {
components: { TemplatesList }, components: { TemplatesList },
middleware: 'auth',
setup () { setup () {
definePageMeta({
middleware: "auth"
})
useOpnSeoMeta({ useOpnSeoMeta({
title: 'My Templates', title: 'My Templates',
description: 'Our collection of beautiful templates to create your own forms!' description: 'Our collection of beautiful templates to create your own forms!'