I have a subdomain for the partner dashboard and normal site. Both of are nuxt project.
Site : example.com
Subdomain: partner-dashboard.example.com
Cookie Plugin: https://www.npmjs.com/package/cookie-universal-nuxt
If the user logged in, I set user information as a cookie for both of them and then redirecting the user to the dashboard. But there are no user cookies on the redirected subdomain project?
Example.com Cookie set and Redirect to Dashboard Func:
// set cookie
this.$cookies.set('user', JSON.stringify(loginData))
this.$cookies.set('user', JSON.stringify(loginData), {
domain: 'partner-dashboard.example.com'
})
setTimeout(() => {
window.location = 'https://partner-dashboard.example.com'
}, 1000)
partner-dashboard.example.com Middleware:
export default function({ app, redirect }) {
const user = app.$cookies.get('user')
if (user && user.registered) {
redirect('/dashboard')
}
}
I want If the user logged in to the normal site, redirect to the dashboard with the user cookie. Then middleware can redirect it to inside because the user cookie is not null.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…