feat(auth): 实现基于令牌的用户认证和访问控制
- 在用户相关页面服务端加载函数中添加令牌检查,防止未授权访问 - 更新用户服务方法以支持携带认证令牌请求API - 修改用户资料和用户列表组件以适配新的认证流程 - 引入侧边栏状态管理并在布局中注册上下文 - 调整HTTP客户端逻辑以正确传递请求头信息 - 更新用户类型定义以匹配后端返回的角色结构 - 优化应用头部和侧边栏组件的UI细节和交互逻辑
This commit is contained in:
@@ -14,6 +14,7 @@ const API_BASE_URL = import.meta.env.VITE_PUBLIC_API_URL || 'http://localhost:18
|
||||
const normalizeHeaders = (headers?: HeadersInit):Record<string, string> =>{
|
||||
const result:Record<string,string> = {};
|
||||
|
||||
console.log('normalizeHeaders', headers);
|
||||
if (!headers){
|
||||
return result;
|
||||
}
|
||||
@@ -28,9 +29,14 @@ const normalizeHeaders = (headers?: HeadersInit):Record<string, string> =>{
|
||||
})
|
||||
}else {
|
||||
Object.keys(headers).forEach(key => {
|
||||
result[key.toLowerCase()] = headers[key.toLowerCase()] as string;
|
||||
const value = (headers as Record<string, string>)[key];
|
||||
if (value !== undefined && value !== null) {
|
||||
result[key.toLowerCase()] = value;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
console.log('normalizeHeaders result:', result);
|
||||
return result;
|
||||
}
|
||||
export class HttpError extends Error {
|
||||
@@ -59,13 +65,14 @@ const httpRequest = async <T>(
|
||||
const fullUrl = `${API_BASE_URL}${url}`;
|
||||
const { body, headers, ...rest } = options;
|
||||
|
||||
|
||||
|
||||
const requestHeaders: Record<string, string> = normalizeHeaders(headers);
|
||||
let requestBody: BodyInit | undefined;
|
||||
|
||||
const canHaveBody = method !== 'GET' ;
|
||||
|
||||
if (canHaveBody) {
|
||||
console.log('body', body);
|
||||
if (body instanceof FormData) {
|
||||
requestBody = body;
|
||||
} else if (body) {
|
||||
@@ -74,12 +81,11 @@ const httpRequest = async <T>(
|
||||
}
|
||||
}
|
||||
|
||||
// ... Token 处理逻辑保持不变 ...
|
||||
// if (currentToken && currentTokenHead) {
|
||||
// requestHeaders['authorization'] = `${currentTokenHead} ${currentToken}`;
|
||||
// }
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
const response = await fetch(fullUrl, {
|
||||
method,
|
||||
headers: requestHeaders,
|
||||
@@ -89,6 +95,8 @@ const httpRequest = async <T>(
|
||||
...rest
|
||||
});
|
||||
|
||||
console.log('response', response);
|
||||
|
||||
if (!response.ok) {
|
||||
let errorDetail;
|
||||
try {
|
||||
|
||||
@@ -3,18 +3,23 @@ import type { UserProfile } from '$lib/types/user.ts';
|
||||
import type { PageResult } from '$lib/types/dataTable.ts';
|
||||
|
||||
export const userService = {
|
||||
getUserProfile: async ({ tokenHead, token}) => {
|
||||
const response = await api.get<UserProfile>('/user/profile');
|
||||
getUserProfile: async (token:string) => {
|
||||
const response = await api.get<UserProfile>('/user/profile', {headers: {Authorization: `${token}`}});
|
||||
if (response.code != 200 || !response.data){
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
return response.data;
|
||||
},
|
||||
getAllUsers: async ({ page, size}: { page: number, size: number}) => {
|
||||
getAllUsers: async ({ page, size,token}: { page: number, size: number, token:string}) => {
|
||||
const formData = new FormData();
|
||||
formData.append('pageNum', page.toString());
|
||||
formData.append('pageSize', size.toString());
|
||||
const response = await api.get<PageResult<UserProfile>[]>('/user/all', {body: formData});
|
||||
const response = await api.get<PageResult<UserProfile>>(
|
||||
'/user/all',
|
||||
{
|
||||
body: formData,
|
||||
headers: {Authorization: `${token}`}
|
||||
});
|
||||
if (response.code != 200 || !response.data){
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
|
||||
@@ -2,21 +2,24 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import Icon from '$lib/components/icon/Icon.svelte';
|
||||
import ThemeSelector from '$lib/widget/ThemeSelector.svelte';
|
||||
|
||||
</script>
|
||||
|
||||
<header class="w-full h-18 flex justify-between items-center px-4 bg-base-300 flex-shrink-0">
|
||||
<div>
|
||||
<button
|
||||
class="btn btn-square btn-ghost"
|
||||
aria-label="Toggle Sidebar"
|
||||
>
|
||||
<Icon id="menu" size="24" />
|
||||
</button>
|
||||
<!-- <button-->
|
||||
<!-- class="btn btn-square btn-ghost"-->
|
||||
<!-- aria-label="Toggle Sidebar"-->
|
||||
<!-- onclick={sidebarState.toggleSidebar}-->
|
||||
<!-- >-->
|
||||
<!-- <Icon id="menu" size="24" />-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="flex justify-center items-center gap-4 select-none">
|
||||
<ThemeSelector/>
|
||||
|
||||
@@ -25,11 +28,11 @@
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="rounded-full bg-primary h-8 w-8 p-4 flex items-center justify-center text-primary-content font-bold"
|
||||
class="rounded-full cursor-pointer shadow-base-content bg-base-100/50 p-0.5 flex items-center justify-center text-primary-content font-bold"
|
||||
>
|
||||
{#if page.data.user.avatar}
|
||||
<img
|
||||
class="w-8 h-8 rounded-full"
|
||||
class="w-8 h-8 rounded-full z-10"
|
||||
src="{page.data.user.avatar}"
|
||||
alt="Avatar"
|
||||
/>
|
||||
|
||||
@@ -1,272 +1,522 @@
|
||||
<script lang="ts">
|
||||
|
||||
import { resolve } from '$app/paths';
|
||||
|
||||
import { page } from '$app/state';
|
||||
|
||||
import { fly, fade } from 'svelte/transition';
|
||||
|
||||
import Icon from '$lib/components/icon/Icon.svelte';
|
||||
|
||||
import type { NavItem, ProcessedNavItem } from '$lib/types/layout';
|
||||
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
import { TOAST_KEY, type ToastState } from '$lib/stores/toast.svelte.ts';
|
||||
|
||||
import { enhance } from '$app/forms';
|
||||
|
||||
import { SIDEBAR_KEY, SidebarState } from '$lib/stores/sidebar.svelte.ts';
|
||||
|
||||
const sidebarState = getContext<SidebarState>(SIDEBAR_KEY);
|
||||
|
||||
|
||||
// 1. 模拟数据:包含三层结构
|
||||
|
||||
const rawNavItems: NavItem[] = [
|
||||
|
||||
{
|
||||
|
||||
id: 'dashboard',
|
||||
|
||||
label: '仪表盘',
|
||||
|
||||
icon: 'home',
|
||||
|
||||
href: '/app/dashboard'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
id: 'statistics',
|
||||
|
||||
label: '数据看板',
|
||||
|
||||
icon: 'data',
|
||||
|
||||
href: '/app/statistics'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
id: 'settings',
|
||||
|
||||
label: '系统设置',
|
||||
|
||||
icon: 'settings',
|
||||
|
||||
href: '/app/settings',
|
||||
|
||||
subItems: [
|
||||
|
||||
{
|
||||
|
||||
id: 'auth',
|
||||
|
||||
label: '认证管理',
|
||||
|
||||
href: '/app/settings/auth',
|
||||
|
||||
icon: 'auth',
|
||||
|
||||
subItems: [
|
||||
|
||||
{
|
||||
|
||||
id: 'users',
|
||||
|
||||
label: '用户管理',
|
||||
|
||||
href: '/app/settings/auth/users'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
id: 'roles',
|
||||
|
||||
label: '角色权限',
|
||||
|
||||
href: '/app/settings/auth/roles'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
id: 'permissions',
|
||||
|
||||
label: '权限管理',
|
||||
|
||||
href: '/app/settings/auth/permissions'
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
|
||||
id: 'advanced',
|
||||
|
||||
label: '高级设置',
|
||||
|
||||
href: '/app/settings/advanced',
|
||||
|
||||
subItems: [
|
||||
|
||||
{
|
||||
|
||||
id: 'logs',
|
||||
|
||||
label: '安全日志',
|
||||
|
||||
href: '/app/settings/advanced/logs'
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
id: 'backup',
|
||||
|
||||
label: '备份恢复',
|
||||
|
||||
href: '/app/settings/advanced/backup'
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 递归计算高亮状态 (强类型版本)
|
||||
|
||||
*/
|
||||
|
||||
function processNavItems(items: NavItem[], currentPath: string): ProcessedNavItem[] {
|
||||
|
||||
return items.map((item) => {
|
||||
|
||||
const isSelfActive =
|
||||
|
||||
item.href === '/' ? currentPath === '/' : currentPath.startsWith(item.href);
|
||||
|
||||
|
||||
let processedSubItems: ProcessedNavItem[] | undefined = undefined;
|
||||
|
||||
let isChildActive = false;
|
||||
|
||||
|
||||
if (item.subItems) {
|
||||
// 递归调用
|
||||
|
||||
// 递归调用
|
||||
|
||||
processedSubItems = processNavItems(item.subItems, currentPath);
|
||||
// 检查子项激活状态
|
||||
|
||||
// 检查子项激活状态
|
||||
|
||||
isChildActive = processedSubItems.some((sub) => sub.isActive || sub.isChildActive);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
|
||||
...item,
|
||||
|
||||
subItems: processedSubItems, // 这里类型现在是 ProcessedNavItem[]
|
||||
|
||||
isActive: isSelfActive,
|
||||
|
||||
isChildActive: isChildActive
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 使用 $derived 动态计算,类型自动推断为 ProcessedNavItem[]
|
||||
|
||||
let navItems = $derived(processNavItems(rawNavItems, page.url.pathname));
|
||||
|
||||
|
||||
// 获取 Toast 以便提示用户
|
||||
|
||||
const toast = getContext<ToastState>(TOAST_KEY);
|
||||
|
||||
|
||||
// 处理提交结果的回调
|
||||
|
||||
const handleLogout = () => {
|
||||
|
||||
toast.info('正在退出登录...');
|
||||
|
||||
return async ({ result, update }) => {
|
||||
|
||||
// result.type 可能是 'redirect', 'success', 'failure'
|
||||
|
||||
// result.type 可能是 'redirect', 'success', 'failure'
|
||||
|
||||
if (result.type === 'redirect') {
|
||||
|
||||
toast.success('您已安全退出');
|
||||
|
||||
}
|
||||
|
||||
// update() 会触发默认行为(也就是执行 redirect 跳转)
|
||||
|
||||
// update() 会触发默认行为(也就是执行 redirect 跳转)
|
||||
|
||||
await update();
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
let logoutForm: HTMLFormElement;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- 定义递归 Snippet,显式指定类型 -->
|
||||
|
||||
{#snippet menuItem(item: ProcessedNavItem)}
|
||||
|
||||
<li>
|
||||
|
||||
{#if item.subItems && item.subItems.length > 0}
|
||||
|
||||
<details open={item.isChildActive}>
|
||||
|
||||
<summary class="group {item.isActive ? 'text-primary font-medium' : ''}">
|
||||
|
||||
{#if item.icon}
|
||||
|
||||
<Icon id={item.icon} size="20" />
|
||||
|
||||
{/if}
|
||||
|
||||
<span class="truncate">{item.label}</span>
|
||||
|
||||
</summary>
|
||||
|
||||
<ul>
|
||||
|
||||
{#each item.subItems as subItem (subItem.id)}
|
||||
|
||||
<!-- 递归渲染子项 -->
|
||||
|
||||
{@render menuItem(subItem)}
|
||||
|
||||
{/each}
|
||||
|
||||
</ul>
|
||||
|
||||
</details>
|
||||
|
||||
{:else}
|
||||
|
||||
<a
|
||||
|
||||
href={resolve(item.href)}
|
||||
|
||||
class="group {item.isActive ? 'active font-medium' : ''}"
|
||||
|
||||
>
|
||||
|
||||
{#if item.icon}
|
||||
|
||||
<Icon id={item.icon} size="20" />
|
||||
|
||||
{:else}
|
||||
|
||||
<!-- 无图标时的占位符,保持对齐 -->
|
||||
|
||||
<span class="w-5 text-center text-xs opacity-50">•</span>
|
||||
|
||||
{/if}
|
||||
|
||||
<span class="truncate">{item.label}</span>
|
||||
|
||||
</a>
|
||||
|
||||
{/if}
|
||||
|
||||
</li>
|
||||
|
||||
{/snippet}
|
||||
|
||||
|
||||
<div
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="fixed inset-0 z-20 cursor-pointer bg-black/50 backdrop-blur-sm md:hidden"
|
||||
<div
|
||||
|
||||
transition:fade={{ duration: 200 }}
|
||||
></div>
|
||||
role="button"
|
||||
|
||||
<aside
|
||||
in:fly={{ duration: 200, x: -100 }}
|
||||
out:fly={{ duration: 200, x: -100 }}
|
||||
class="bg-base-200 border-base-100/70 fixed z-30 flex h-full w-64 flex-shrink-0 flex-col border-r md:relative"
|
||||
>
|
||||
<div class="h-18 flex flex-shrink-0 items-center p-4">
|
||||
<a
|
||||
href={resolve('/app/dashboard')}
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<Icon id="logo" size="32" className="flex-shrink-0 rounded-box" />
|
||||
<p class="truncate font-serif text-lg font-bold">IT DTMS</p>
|
||||
</a>
|
||||
</div>
|
||||
tabindex="0"
|
||||
|
||||
<div class="custom-scrollbar flex-1 overflow-y-auto">
|
||||
<ul class="menu menu-vertical w-full gap-1 px-2">
|
||||
{#each navItems as item (item.id)}
|
||||
<!-- 初始渲染调用 -->
|
||||
{@render menuItem(item)}
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
class="fixed inset-0 z-20 cursor-pointer bg-black/50 backdrop-blur-sm md:hidden"
|
||||
|
||||
|
||||
{#if page.data.user}
|
||||
<div class="border-base-content/10 bg-base-200/50 flex-shrink-0 border-t p-3">
|
||||
<div class="dropdown dropdown-top dropdown-end w-full">
|
||||
<div
|
||||
tabindex="0"
|
||||
role="button"
|
||||
class="hover:bg-base-300 flex w-full cursor-pointer items-center gap-3 rounded-lg p-2 transition-colors"
|
||||
>
|
||||
<div class="avatar placeholder">
|
||||
<div class="bg-neutral text-neutral-content w-10 rounded-full">
|
||||
<img src={page.data.user.avatar} alt="avatar" />
|
||||
<span class="text-xs">User</span>
|
||||
</div>
|
||||
transition:fade={{ duration: 200 }}
|
||||
|
||||
></div>
|
||||
|
||||
|
||||
<aside
|
||||
|
||||
in:fly={{ duration: 200, x: -100 }}
|
||||
|
||||
out:fly={{ duration: 200, x: -100 }}
|
||||
|
||||
class="bg-base-200 border-base-100/70 fixed z-30 flex h-full w-64 flex-shrink-0 flex-col border-r md:relative"
|
||||
|
||||
>
|
||||
|
||||
<div class="h-18 flex flex-shrink-0 items-center p-4">
|
||||
|
||||
<a
|
||||
|
||||
href={resolve('/app/dashboard')}
|
||||
|
||||
class="flex items-center gap-3"
|
||||
|
||||
>
|
||||
|
||||
<Icon id="logo" size="32" className="flex-shrink-0 rounded-box" />
|
||||
|
||||
<p class="truncate font-serif text-lg font-bold">IT DTMS</p>
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="custom-scrollbar flex-1 overflow-y-auto">
|
||||
|
||||
<ul class="menu menu-vertical w-full gap-1 px-2">
|
||||
|
||||
{#each navItems as item (item.id)}
|
||||
|
||||
<!-- 初始渲染调用 -->
|
||||
|
||||
{@render menuItem(item)}
|
||||
|
||||
{/each}
|
||||
|
||||
</ul>
|
||||
<!-- 状态: {sidebarState.isSidebarExpanded ? '展开' : '收起'}-->
|
||||
<!-- <button-->
|
||||
<!-- onclick="{sidebarState.toggleSidebar}"-->
|
||||
<!-- class="btn btn-square btn-ghost">-->
|
||||
<!-- 123-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
|
||||
|
||||
{#if page.data.user}
|
||||
|
||||
<div class="border-base-content/10 bg-base-200/50 flex-shrink-0 border-t p-3">
|
||||
|
||||
<div class="dropdown dropdown-top dropdown-end w-full">
|
||||
|
||||
<div
|
||||
|
||||
tabindex="0"
|
||||
|
||||
role="button"
|
||||
|
||||
class="hover:bg-base-300 flex w-full cursor-pointer items-center gap-3 rounded-lg p-2 transition-colors"
|
||||
|
||||
>
|
||||
|
||||
<div class="avatar placeholder">
|
||||
|
||||
<div class="bg-neutral text-neutral-content w-10 rounded-full">
|
||||
|
||||
<img src={page.data.user.avatar} alt="avatar" />
|
||||
|
||||
<span class="text-xs">User</span>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex min-w-0 flex-1 flex-col">
|
||||
<span class="truncate text-sm font-bold">{page.data.user.nickname}</span>
|
||||
<span class="text-base-content/60 truncate text-xs"
|
||||
>@{page.data.user.username}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
<Icon id="chevron-up-down" size="16" className="opacity-50" />
|
||||
</div>
|
||||
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="dropdown-content z-[1] menu rounded-box border-base-content/10 mb-2 w-60 border bg-base-100 p-2 shadow-lg"
|
||||
>
|
||||
<li class="menu-title px-4 py-2">我的账户</li>
|
||||
<li>
|
||||
<a href="/app/profile"><Icon id="user-profile" size="16" /> 个人资料</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/app/settings"><Icon id="settings" size="16" /> 设置</a>
|
||||
</li>
|
||||
<div class="divider my-1"></div>
|
||||
|
||||
<li class="">
|
||||
<button
|
||||
class="text-error w-full text-left flex items-center gap-2"
|
||||
on:click={() => logoutForm.requestSubmit()}
|
||||
>
|
||||
<Icon id="sign-out" size="16" /> 退出登录
|
||||
</button>
|
||||
</li>
|
||||
<form
|
||||
action="/auth/logout"
|
||||
method="POST"
|
||||
use:enhance={handleLogout}
|
||||
bind:this={logoutForm}
|
||||
hidden
|
||||
<div class="flex min-w-0 flex-1 flex-col">
|
||||
|
||||
<span class="truncate text-sm font-bold">{page.data.user.nickname}</span>
|
||||
|
||||
<span class="text-base-content/60 truncate text-xs"
|
||||
|
||||
>@{page.data.user.username}</span
|
||||
|
||||
>
|
||||
</form>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<Icon id="chevron-up-down" size="16" className="opacity-50" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<ul
|
||||
|
||||
tabindex="0"
|
||||
|
||||
class="dropdown-content z-[1] menu rounded-box border-base-content/10 mb-2 w-60 border bg-base-100 p-2 shadow-lg"
|
||||
|
||||
>
|
||||
|
||||
<li class="menu-title px-4 py-2">我的账户</li>
|
||||
|
||||
<li>
|
||||
|
||||
<a href="/app/user">
|
||||
<Icon id="user-profile" size="16" />
|
||||
个人资料</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<a href="/app/settings">
|
||||
<Icon id="settings" size="16" />
|
||||
设置</a>
|
||||
|
||||
</li>
|
||||
|
||||
<div class="divider my-1"></div>
|
||||
|
||||
|
||||
<li class="">
|
||||
|
||||
<button
|
||||
|
||||
class="text-error w-full text-left flex items-center gap-2"
|
||||
|
||||
onclick={() => logoutForm.requestSubmit()}
|
||||
|
||||
>
|
||||
|
||||
<Icon id="sign-out" size="16" />
|
||||
退出登录
|
||||
|
||||
</button>
|
||||
|
||||
</li>
|
||||
|
||||
<form
|
||||
|
||||
action="/auth/logout"
|
||||
|
||||
method="POST"
|
||||
|
||||
use:enhance={handleLogout}
|
||||
|
||||
bind:this={logoutForm}
|
||||
|
||||
hidden
|
||||
|
||||
>
|
||||
|
||||
</form>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
</aside>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
/* 保持原有样式 */
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar {
|
||||
|
||||
width: 5px;
|
||||
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-track {
|
||||
|
||||
background: transparent;
|
||||
|
||||
}
|
||||
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb {
|
||||
|
||||
background-color: rgba(156, 163, 175, 0.3);
|
||||
|
||||
border-radius: 20px;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
20
src/lib/stores/sidebar.svelte.ts
Normal file
20
src/lib/stores/sidebar.svelte.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export class SidebarState {
|
||||
isSidebarExpanded = $state(true);
|
||||
|
||||
constructor(initialIsSidebarExpanded = true) {
|
||||
this.isSidebarExpanded = initialIsSidebarExpanded;
|
||||
}
|
||||
toggleSidebar = ()=> {
|
||||
this.isSidebarExpanded = !this.isSidebarExpanded;
|
||||
}
|
||||
|
||||
closeSidebar() {
|
||||
this.isSidebarExpanded = false;
|
||||
}
|
||||
|
||||
openSidebar() {
|
||||
this.isSidebarExpanded = true;
|
||||
}
|
||||
}
|
||||
|
||||
export const SIDEBAR_KEY = Symbol('SIDEBAR');
|
||||
@@ -1,8 +1,11 @@
|
||||
export interface UserProfile{
|
||||
id: string;
|
||||
id: number;
|
||||
username : string;
|
||||
nickname : string;
|
||||
roles : string[];
|
||||
roles : {
|
||||
id: number;
|
||||
name: string;
|
||||
}[];
|
||||
avatar? : string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user