/*
 * @Author: your name
 * @Date: 2020-11-19 16:54:53
 * @LastEditTime: 2020-12-11 14:22:27
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \tostumi\src\utils\log.ts
 */
import { message } from 'antd';

export const printf = (playload: any, resp: any) => {
  console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
  console.log(playload);
};

// 退出登录
export const logOut = () => {
  localStorage.removeItem('userInfo');
  localStorage.removeItem('loginTime');
  localStorage.removeItem('permission');
  // 清掉本域名所有cookie
  let keys = document.cookie.match(/[^ =;]+(?==)/g);
  if (keys) {
    for (var i = keys.length; i--; ) {
      document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString();
      document.cookie =
        keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString();
      document.cookie =
        keys[i] + '=0;path=/;domain=ratingdog.cn;expires=' + new Date(0).toUTCString();
    }
  }
  window.location.pathname = '/user/login';
};
