2017-05-15 09:56:45 +00:00
|
|
|
import { param2Obj } from 'utils';
|
|
|
|
|
2017-04-18 07:09:13 +00:00
|
|
|
const userMap = {
|
|
|
|
admin: {
|
|
|
|
role: ['admin'],
|
|
|
|
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: {
|
|
|
|
role: ['editor'],
|
|
|
|
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
|
|
|
},
|
|
|
|
developer: {
|
|
|
|
role: ['develop'],
|
|
|
|
token: 'develop',
|
|
|
|
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: '工程师小王'
|
2017-04-18 07:09:13 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-24 06:15:42 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
loginByEmail: config => {
|
2017-05-15 09:56:45 +00:00
|
|
|
const { email } = JSON.parse(config.body);
|
|
|
|
return userMap[email.split('@')[0]];
|
2017-04-24 06:15:42 +00:00
|
|
|
},
|
|
|
|
getInfo: config => {
|
2017-05-15 09:56:45 +00:00
|
|
|
const { token } = param2Obj(config.url);
|
|
|
|
if (userMap[token]) {
|
|
|
|
return userMap[token];
|
|
|
|
} else {
|
|
|
|
return Promise.reject('a');
|
|
|
|
}
|
2017-04-24 06:15:42 +00:00
|
|
|
},
|
2017-05-15 09:56:45 +00:00
|
|
|
logout: () => 'success'
|
2017-04-24 06:15:42 +00:00
|
|
|
};
|