Answer the question
In order to leave comments, you need to log in
How to properly block access to the route?
I want to block access to unauthorized users.
Wrote this code.
router.beforeEach((to, from, next) => {
const authUser = localStorage.getItem("auth");
const profilePages = ["/profile"];
const orderPaymnetPages = ["/order-payment"];
const authRequired = !profilePages.includes(to.path);
const authRequired2 = !orderPaymnetPages.includes(to.path);
if (authRequired && authRequired2 && !authUser) {
next("/");
}
next();
});
Answer the question
In order to leave comments, you need to log in
In the basic version, at the very moment the background image appears, its properties change transform: scale
(reduce the size), filter: blur
(reduce the blur) and opacity
(either make this image appear, or leave the previous background with the preloader). Then it smoothly changes transform: translate
depending on the position of the mouse or something else (the video shows that everything "rides" a little). The main danger that could be waiting is the poor performance of CSS filters, so things can get a bit sluggish.
In a good way, of course, it would be worth writing all this in shaders and instead of screwing transform: translate
something like fake3d , but that's a completely different story...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question