Blame view

mock/demo/account.ts 1.42 KB
1
import { MockMethod } from 'vite-plugin-mock';
2
import { resultSuccess, resultError } from '../_util';
3
import { ResultEnum } from '../../src/enums/httpEnum';
4
5

const userInfo = {
6
  name: 'Vben',
7
  userid: '00000001',
vben authored
8
  email: 'test@gmail.com',
9
10
11
  signature: '海纳百川,有容乃大',
  introduction: '微笑着,努力着,欣赏着',
  title: '交互专家',
vben authored
12
  group: '某某某事业群-某某平台部-某某技术部-UED',
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  tags: [
    {
      key: '0',
      label: '很有想法的',
    },
    {
      key: '1',
      label: '专注设计',
    },
    {
      key: '2',
      label: '辣~',
    },
    {
      key: '3',
      label: '大长腿',
    },
    {
      key: '4',
      label: '川妹子',
    },
    {
      key: '5',
      label: '海纳百川',
    },
  ],
  notifyCount: 12,
  unreadCount: 11,
  country: 'China',
vben authored
42
  address: 'Xiamen City 77',
vben authored
43
  phone: '0592-268888888',
44
45
46
47
};

export default [
  {
48
    url: '/basic-api/account/getAccountInfo',
49
50
51
52
53
54
    timeout: 1000,
    method: 'get',
    response: () => {
      return resultSuccess(userInfo);
    },
  },
55
56
57
58
59
60
61
62
  {
    url: '/basic-api/user/sessionTimeout',
    method: 'post',
    statusCode: 401,
    response: () => {
      return resultError();
    },
  },
63
64
65
66
67
68
69
70
  {
    url: '/basic-api/user/tokenExpired',
    method: 'post',
    statusCode: 200,
    response: () => {
      return resultError('Token Expired!', { code: ResultEnum.TIMEOUT as number });
    },
  },
71
] as MockMethod[];