2017-04-18 07:09:13 +00:00
|
|
|
const userMap = {
|
|
|
|
admin: {
|
2018-01-05 03:38:34 +00:00
|
|
|
roles: ['admin'],
|
2017-04-18 07:09:13 +00:00
|
|
|
token: 'admin',
|
|
|
|
introduction: '我是超级管理员',
|
2017-05-31 08:49:24 +00:00
|
|
|
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
2017-07-06 09:56:17 +00:00
|
|
|
name: 'Super Admin'
|
2017-04-18 07:09:13 +00:00
|
|
|
},
|
|
|
|
editor: {
|
2018-01-05 03:38:34 +00:00
|
|
|
roles: ['editor'],
|
2017-04-18 07:09:13 +00:00
|
|
|
token: 'editor',
|
|
|
|
introduction: '我是编辑',
|
2017-05-31 08:49:24 +00:00
|
|
|
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
2017-07-06 09:56:17 +00:00
|
|
|
name: 'Normal Editor'
|
2017-04-18 07:09:13 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-24 06:15:42 +00:00
|
|
|
|
|
|
|
export default {
|
2018-10-29 05:55:36 +00:00
|
|
|
'/login/login': config => {
|
|
|
|
const { username } = config.body
|
2017-08-22 07:43:34 +00:00
|
|
|
return userMap[username]
|
2017-04-24 06:15:42 +00:00
|
|
|
},
|
2018-10-29 05:55:36 +00:00
|
|
|
'/login/logout': 'success',
|
|
|
|
'/user/info': config => {
|
|
|
|
const { token } = config.query
|
2017-05-15 09:56:45 +00:00
|
|
|
if (userMap[token]) {
|
2017-08-22 07:43:34 +00:00
|
|
|
return userMap[token]
|
2017-05-15 09:56:45 +00:00
|
|
|
} else {
|
2017-10-25 09:12:36 +00:00
|
|
|
return false
|
2017-05-15 09:56:45 +00:00
|
|
|
}
|
2018-10-29 05:55:36 +00:00
|
|
|
}
|
2017-08-22 07:43:34 +00:00
|
|
|
}
|
2018-10-29 05:55:36 +00:00
|
|
|
|