text: /*!
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing,
   * software distributed under the License is distributed on an
   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
   */
  
  import Mock from 'mockjs2'
  import { builder, getBody } from '../util'
  
  const username = ['admin', 'super']
  const password = ['8914de686ab28dc22f30d3d8e107ff6c', '21232f297a57a5a743894a0e4a801fc3'] // admin, ant.design
  
  const login = (options) => {
    const body = getBody(options)
    console.log('mock: body', body)
    if (!username.includes(body.username) || !password.includes(body.password)) {
      return builder({ isLogin: true }, 'Username or password is wrong.', 401)
    }
  
    return builder({
      'id': Mock.mock('@guid'),
      'name': Mock.mock('@name'),
      'username': 'admin',
      'password': '',
      'status': 1,
      'telephone': '',
      'lastLoginIp': '27.154.74.117',
      'lastLoginTime': 1534837621348,
      'creatorId': 'admin',
      'createTime': 1497160610259,
      'deleted': 0,
      'roleId': 'admin',
      'lang': 'zh-CN',
      'token': '4291d7da9005377ec9aec4a71ea837f'
    }, '', 200, { 'Custom-Header': Mock.mock('@guid') })
  }
  
  const logout = () => {
    return builder({}, 'logout successfully')
  }
  
  Mock.mock(/\/auth\/login/, 'post', login)
  Mock.mock(/\/auth\/logout/, 'post', logout)
  