Adding Custom domains (#247)
* WIP * wip * Finished doing most of the work
This commit is contained in:
16
resources/js/middleware/custom-domains.js
vendored
Normal file
16
resources/js/middleware/custom-domains.js
vendored
Normal 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
|
||||
}
|
||||
17
resources/js/middleware/notion-connection.js
vendored
17
resources/js/middleware/notion-connection.js
vendored
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user