Remove appconfig in favor of runtimeconfig

This commit is contained in:
Julien Nahum
2024-01-03 17:38:11 +01:00
parent a51ccfebec
commit a6d88278be
18 changed files with 103 additions and 90 deletions

View File

@@ -192,6 +192,7 @@ import AiFeature from '~/components/pages/welcome/AiFeature.vue'
import Testimonials from '../components/pages/welcome/Testimonials.vue'
import TemplatesSlider from '../components/pages/welcome/TemplatesSlider.vue'
import SeoMeta from '../mixins/seo-meta.js'
import opnformConfig from "~/opnform.config.js";
export default {
components: {Testimonials, Features, MoreFeatures, PricingTable, AiFeature, TemplatesSlider},
@@ -206,7 +207,8 @@ export default {
return {
authenticated: computed(() => authStore.check),
config: useAppConfig()
config: opnformConfig,
runtimeConfig: useRuntimeConfig()
}
},
@@ -220,7 +222,7 @@ export default {
return this.config.links
},
paidPlansEnabled() {
return this.config.paid_plans_enabled
return this.runtimeConfig.public.paidPlansEnabled
},
}
}

View File

@@ -249,7 +249,7 @@ export default {
middleware: [
function (to, from) {
// Custom inline middleware
if (!useAppConfig().paid_plans_enabled) { // If no paid plan so no need this page
if (!useRuntimeConfig().public.paidPlansEnabled) { // If no paid plan so no need this page
return navigateTo('/', { redirectCode: 301 })
}
},

View File

@@ -116,7 +116,6 @@
<script setup>
import {watch} from "vue";
import opnformConfig from "~/opnform.config.js";
import {fetchAllWorkspaces} from "~/stores/workspaces.js";
const crisp = useCrisp()
@@ -133,7 +132,7 @@ let customDomains = ''
let customDomainsLoading = ref(false)
let workspace = computed(() => workspacesStore.getCurrent)
let customDomainsEnabled = computed(() => opnformConfig.custom_domains_enabled)
let customDomainsEnabled = computed(() => useRuntimeConfig().public.customDomainsEnabled)
watch(() => workspace, () => {
initCustomDomains()