feat: Implement enhanced user profiles with social features including direct messaging, post comments, and reposts, and introduce new routing for Docs and Changelog views.
This commit is contained in:
64
client/src/router/index.js
Normal file
64
client/src/router/index.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import ChatLayout from '../components/ChatLayout.vue';
|
||||
import WalletConnect from '../components/WalletConnect.vue';
|
||||
import { useChatStore } from '../stores/chat';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/chat/nebula'
|
||||
},
|
||||
{
|
||||
path: '/chat/:channel?',
|
||||
name: 'Chat',
|
||||
component: ChatLayout,
|
||||
meta: { requiresAuth: true },
|
||||
props: true
|
||||
},
|
||||
{
|
||||
path: '/profile/:address?',
|
||||
name: 'Profile',
|
||||
component: ChatLayout,
|
||||
meta: { requiresAuth: true },
|
||||
props: route => ({ viewProfile: true, profileAddress: route.params.address })
|
||||
},
|
||||
{
|
||||
path: '/docs',
|
||||
name: 'Docs',
|
||||
component: ChatLayout,
|
||||
meta: { requiresAuth: true },
|
||||
props: { viewDocs: true }
|
||||
},
|
||||
{
|
||||
path: '/changelog',
|
||||
name: 'Changelog',
|
||||
component: ChatLayout,
|
||||
meta: { requiresAuth: true },
|
||||
props: { viewChangelog: true }
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: WalletConnect
|
||||
}
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const chatStore = useChatStore();
|
||||
const isAuthenticated = chatStore.checkAuth();
|
||||
|
||||
if (to.meta.requiresAuth && !isAuthenticated) {
|
||||
next('/login');
|
||||
} else if (to.path === '/login' && isAuthenticated) {
|
||||
next('/chat/nebula');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user