_mock.ts 843 Bytes
Newer Older
陈帅's avatar
陈帅 committed
1
function getFakeCaptcha(req: any, res: { json: (arg0: string) => void }) {
2 3 4 5
  return res.json('captcha-xxx');
}

export default {
陈帅's avatar
陈帅 committed
6 7 8 9 10 11
  'POST /api/BLOCK_NAME/account': (
    req: { body: { password: any; userName: any; type: any } },
    res: {
      send: (data: any) => void;
    }
  ) => {
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    const { password, userName, type } = req.body;
    if (password === 'ant.design' && userName === 'admin') {
      res.send({
        status: 'ok',
        type,
        currentAuthority: 'admin',
      });
      return;
    }
    if (password === 'ant.design' && userName === 'user') {
      res.send({
        status: 'ok',
        type,
        currentAuthority: 'user',
      });
      return;
    }
    res.send({
      status: 'error',
      type,
      currentAuthority: 'guest',
    });
  },
  'GET /api/BLOCK_NAME/captcha': getFakeCaptcha,
};