import {
  errorConfig,
  requestInterceptors,
  responseInterceptors,
} from '@/utils/request';
import type { RequestConfig } from '@umijs/max';
import { Base64 } from 'js-base64';
import { getUrlQuery } from './utils/comm'; 
import { setCookie } from './utils/cookie';
import { setSession } from './utils/session';

//request 配置
export const request: RequestConfig = {
  timeout: 10000,
  errorConfig,
  requestInterceptors,
  responseInterceptors,
};

// 接收登录参数
let token = getUrlQuery('access_token');
if (token) {
  setSession('token', Base64.decode(token));
}

