0👍
from the title of this question, you can add a hook in vue component that will run when before the route is changed
beforeRouteLeave (to, from, next) {
// called when the route that renders this component is about to
// be navigated away from.
// has access to `this` component instance.
}
if you want user to move to the next route on which he clicked, you will call next()
inside this hook and he will be navigated to the next page.
if you want to lock him and not navigate, pass false in this next()
method like next(false)
0👍
Why don’t you just create a middleware server side that redirects the user to the workspace creation page if the user didn’t have one yet? Something like that in laravel
class RedirectIfWorkspaceNotCreated
{
public function handle($request, Closure $next, $guard = null)
{
$user = Auth::guard($guard)->user();
if ($user && !checkForUserWorkspace) {
return redirect('/your/workspace/creation/page');
}
return $next($request);
}
}
Source:stackexchange.com