KnowledgeBase_frontend/src/store/notificationCenter/notificationCenter.slice.js

65 lines
1.7 KiB
JavaScript
Raw Normal View History

2025-03-20 10:01:09 +08:00
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
notifications: [
{
id: 1,
type: 'permission',
icon: 'bi-shield',
title: '新的权限请求',
content: '张三请求访问销售数据集',
time: '10分钟前',
hasDetail: true,
},
{
id: 2,
type: 'system',
icon: 'bi-info-circle',
title: '系统更新通知',
content: '系统将在今晚23:00进行例行维护',
time: '1小时前',
hasDetail: false,
},
{
id: 3,
type: 'permission',
icon: 'bi-shield',
title: '新的权限请求',
content: '李四请求访问用户数据集',
time: '2小时前',
hasDetail: true,
},
{
id: 4,
type: 'system',
icon: 'bi-exclamation-circle',
title: '安全提醒',
content: '检测到异常登录行为,请及时查看',
time: '3小时前',
hasDetail: true,
},
{
id: 5,
type: 'permission',
icon: 'bi-shield',
title: '权限变更通知',
content: '管理员修改了您的数据访问权限',
time: '1天前',
hasDetail: true,
},
],
};
const notificationCenterSlice = createSlice({
name: 'notificationCenter',
initialState,
reducers: {
clearNotifications: (state) => {
state.notifications = [];
},
},
});
export const { clearNotifications } = notificationCenterSlice.actions;
export default notificationCenterSlice.reducer;