第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

在react代碼中的axios攔截器中做鏈接的轉(zhuǎn)跳

在react代碼中的axios攔截器中做鏈接的轉(zhuǎn)跳

慕桂英3389331 2019-03-13 18:19:44
這個(gè)是React中使用的axios攔截器,如何在攔截器中做一個(gè)react的路由轉(zhuǎn)跳?import Axios from 'axios'Axios.interceptors.request.use(function (config) {  let token = window.localStorage.token;  if (token) {    config.headers.Authorization = `token ${token}`  }  return config}, function (error) {  return Promise.reject(error);});Axios.interceptors.request.use(function (config) {  return config}, function (error) {  // 如何在這里加入react中的路由轉(zhuǎn)跳?  return Promise.reject(error);});
查看完整描述

3 回答

?
長(zhǎng)風(fēng)秋雁

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超7個(gè)贊

//react-router-dom (rrouter v4),如果用brower方式的話,把createHashHistory替換createBrowerHistory就可以了

import {createHashHistory} from 'history';

const history = createHashHistory();

history.push('路由地址');


//react-router v3,如果用brower方式的話,把hashHistory替換browerHistory就可以了

import {hashHistory} from 'react-router';

hashHistory.push('路由地址');


查看完整回答
1 反對(duì) 回復(fù) 2019-04-03
  • 3 回答
  • 0 關(guān)注
  • 2811 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)