axios

    0熱度

    1回答

    我在javascript中很弱,但我想我明白髮生了什麼問題。只是不夠流暢,無法知道如何修復它,甚至不知道如何正確編寫它。我有一個VueJS應用程序,它向access_token的API發送請求。當access_token到期時,它會向API發送refresh_token,並獲取新的access_token。我希望它能夠在它過期時重新運行正在運行的請求。使用下面的代碼我會得到奇怪的行爲。當它遇到40

    0熱度

    1回答

    我試圖單元測試一個腳本,它將部分依賴從axios.get()請求返回給外部資源的數據。 一個測試功能我目前看起來是這樣的: export function getFeedData (sub) { if (getFeedId(sub) === 2) { return axios.get('/src/mocks/MockData.json').then((data) => JSO

    1熱度

    1回答

    我不確定什麼時候我的data.json返回奇怪的文本時,我叫它什麼是錯的。 axios.get('./data.json').then(resp => { console.log(resp) console.log(resp.data) }) 試過JSON.parse(resp)它似乎不工作。 https://codesandbox.io/s/306ynznk

    1熱度

    2回答

    我想上傳一個文本文件到我的django後端,但我的request.FILES始終是空的。 我正在使用axios發送文件並按照django的要求將'multipart/form-data'作爲請求的內容類型。 我缺少什麼? new Vue({ el: '#app', data: { reqtype: '', uploadedFile: '', }

    0熱度

    2回答

    這是我的登錄頁面: class Login extends Component { /*define constructor for state props*/ constructor() { super(); this.state = { email: '', password: '' }; this.ha

    4熱度

    3回答

    我想將道具從父組件傳遞給子組件。我的道具是tid。 這是父組件: <div id="tracksec" class="panel-collapse collapse"> <library :tid="track.category_id"></library> </div> 這是子組件: <script> import Chapter from "./chapter"; impo

    1熱度

    1回答

    我的應用程序中有很多AJAX請求,我想爲每個請求顯示加載圖標,並在收到響應時將其刪除。我爲這些調用使用axios,所以我創建了一個簡單的插件類並添加了定製的axios攔截器。 const MyGlobalVariables= { install(Vue, options) { Vue.load_mask = true; MyGlobalVariables.getL

    0熱度

    1回答

    我對當前虛擬環境中運行gunicorn服務器上,使用下列.wsgi文件Django的REST服務: import os, sys import site site.addsitedir('/opt/valuation/env/lib/python2.7/site-packages') sys.stdout = sys.stderr os.environ['DJANGO_SETTINGS

    9熱度

    1回答

    我已經創建了愛可信攔截器負責將令牌之前每個請求被髮送到我的REST API。 import axios from 'axios'; import { store } from '../store/store'; export default function execute() { axios.interceptors.request.use(function(config) {

    0熱度

    1回答

    我剛剛繼承了一個項目,有點隨意使用我不是很熟悉的工具建立。它使用Express,Bookshelf和Axios來訪問MySQL數據庫。 GET和PUT的快速路由似乎工作得很好,但POST和DELETE每個導致錯誤500. 這裏是我使用的路由(我已經刪除了更多的GET和POST路由, ): import express from 'express'; import Points from '../