Слияние кода завершено, страница обновится автоматически
import faker from 'faker'
import { Response, Request } from 'express'
import { asyncRoutes, constantRoutes } from './routes'
import { IRoleData } from '../../src/api/types'
const routes = [...constantRoutes, ...asyncRoutes]
const roles: IRoleData[] = [
{
key: 'admin',
name: 'admin',
description: 'Super Administrator. Have access to view all pages.',
routes: routes
},
{
key: 'editor',
name: 'editor',
description: 'Normal Editor. Can see all pages except permission page',
routes: routes.filter(i => i.path !== '/permission') // Just a mock
},
{
key: 'visitor',
name: 'visitor',
description: 'Just a visitor. Can only see the home page and the document page',
routes: [{
path: '',
redirect: 'dashboard',
children: [
{
path: 'dashboard',
name: 'Dashboard',
meta: { title: 'dashboard', icon: 'dashboard' }
}
]
}]
}
]
export const getRoles = (req: Request, res: Response) => {
return res.json({
code: 20000,
data: {
total: roles.length,
items: roles
}
})
}
export const createRole = (req: Request, res: Response) => {
return res.json({
code: 20000,
data: {
key: faker.random.number({ min: 3, max: 10000 })
}
})
}
export const updateRole = (req: Request, res: Response) => {
const { role } = req.body
return res.json({
code: 20000,
data: {
role
}
})
}
export const deleteRole = (req: Request, res: Response) => {
return res.json({
code: 20000,
})
}
export const getRoutes = (req: Request, res: Response) => {
return res.json({
code: 20000,
data: {
routes
}
})
}
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )