Commit 3c1eb4ed authored by 熊成伟's avatar 熊成伟

debug

parent 8b58f3d1
Pipeline #16414 failed with stages
in 34 seconds
import React, { useState, useEffect } from 'react';
import {WhiteSpace, WingBlank} from "antd-mobile";
import {Toast, WhiteSpace, WingBlank} from "antd-mobile";
// import axiosRequest from '../../utils/request';
import TopSearch from '../../components/TopSearch'
import WorkCard from '../../components/Card/WorkCard';
import Skeleton from '../../components/Skeleton'
import Document from 'react-document-title'
import Empty from '../Empty'
import queryString from "query-string";
const Work = (props) => {
const [start, setStart] = useState(true);
......@@ -15,14 +16,21 @@ const Work = (props) => {
const [data, setData] = useState([])
useEffect(() => {
new Promise((resolve => {
const query = queryString.parse(props.location.search);
const keys = Object.keys(query);
keys.length > 0 && query.token && localStorage.setItem('token', query.token);
resolve()
})).then(() => {
loadOperates();
})
}, []);
const loadOperates = () => {
setLoading(true);
setTimeout(() => {
setLoading(false)
}, 1000)
}, 1000);
const res = localStorage.getItem("menu");
setStart(false);
const result = JSON.parse(res)
......
......@@ -31,9 +31,8 @@ export const createAPI = (baseURL) => {
return (conf = {}) => {
let opts = conf.opts || {};
let urlParams = '';
// console.log(conf);
let headers = { ...defaultHeaders, ...opts.headers };
let headers = { ...defaultHeaders, ...opts.headers, token: conf.token};
if (conf.opts) {
urlParams = "?";
urlParams += qs.stringify(conf.opts)
......
......@@ -27,11 +27,13 @@ const loadingCounter = () => {
let loadingCount = loadingCounter();
async function axiosRequest(option = {}) {
const token = localStorage.getItem("token");
loadingCount.startLoading();
const res = await instance({
method: option.method || 'get',
url: option.url,
opts: option.body || null,
token: token
});
loadingCount.endLoading();
return res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment