再次优化了登陆注册界面与跳转逻辑
This commit is contained in:
@@ -40,32 +40,32 @@ const router = createRouter({
|
||||
path: "/m/messages",
|
||||
name: "mobile-messages",
|
||||
component: () => import("@/views/mobile/MobileMessagesView.vue"),
|
||||
meta: { layout: "blank" },
|
||||
meta: { layout: "blank", requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/m/realname",
|
||||
name: "mobile-realname",
|
||||
component: () => import("@/views/mobile/MobileRealnameView.vue"),
|
||||
meta: { layout: "blank" },
|
||||
meta: { layout: "blank", requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/m/profile",
|
||||
name: "mobile-profile",
|
||||
component: () => import("@/views/mobile/MobileProfileView.vue"),
|
||||
meta: { layout: "blank" },
|
||||
meta: { layout: "blank", requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/m/orders",
|
||||
name: "mobile-orders",
|
||||
component: () => import("@/views/mobile/MobileOrdersView.vue"),
|
||||
meta: { layout: "blank" },
|
||||
meta: { layout: "blank", requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/m/seller/listings/create",
|
||||
name: "mobile-seller-listing-create",
|
||||
component: () =>
|
||||
import("@/views/mobile/MobileSellerListingCreateView.vue"),
|
||||
meta: { layout: "blank" },
|
||||
meta: { layout: "blank", requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
@@ -217,6 +217,10 @@ router.beforeEach((to) => {
|
||||
return { path: toMobilePath(to.path), query: to.query, hash: to.hash };
|
||||
}
|
||||
|
||||
if (to.meta.requiresAuth && !localStorage.getItem("access_token")) {
|
||||
return { path: "/m/login", query: { redirect: to.fullPath } };
|
||||
}
|
||||
|
||||
if (
|
||||
to.path === "/admin/login" &&
|
||||
localStorage.getItem("admin_access_token")
|
||||
|
||||
Reference in New Issue
Block a user