Adding Custom domains (#247)

* WIP

* wip

* Finished doing most of the work
This commit is contained in:
Julien Nahum
2023-11-29 14:53:08 +01:00
committed by GitHub
parent 57fdfb25a0
commit b50f579155
33 changed files with 1210 additions and 267 deletions

View File

@@ -0,0 +1,16 @@
export default async (to, from, next) => {
if (!window.config.custom_domains) {
next()
}
const isCustomDomain = getDomain(window.location.href) !== getDomain(window.config.app_url)
if (isCustomDomain && !['forms.show_public'].includes(to.name)) {
// If route isn't a public form, redirect
window.location.href = 'https://opnform.com/'
} else {
next()
}
}
function getDomain (url) {
return (new URL(url)).hostname
}

View File

@@ -1,17 +0,0 @@
import store from '~/store'
export default async (to, from, next) => {
/* if (store.getters['auth/check'] && store.getters['auth/user'].workspaces_count === 0) {
if ([
'forms.create',
'forms.show',
'forms.edit',
'home'
].includes(to.name)
) {
next({ name: 'onboarding' })
}
}*/
next()
}