Tag:axios

  • Instance code of Axios interceptor token refresh mechanism under Vue

    Time:2020-4-9

    //Create the http.js file. The following is the specific code: //Introducing the installed Axios plug-in import axios from ‘axios’ import router from ‘@/router’; import Vue from ‘vue’ const qs = require(“qs”); let _this = new Vue(); let isLock = false; let refreshSubscribers = []; //Determine whether the token expires function isTokenExpired(token) { let expires_time = […]

  • Configure the local, test and production environment of the Vue project, and configure axios.defaults.baseurl to solve cross domain problems

    Time:2020-1-28

    Recently, I am working on a Vue project. I want to call APIs of different environments through different commands to prevent errors in manually modifying APIs back and forth. I read a lot of articles on the Internet, but I didn’t write them completely. Then I suddenly wanted to write an article by myself. 1、 […]

  • When using the option value of element UI drop-down box in Vue project as an object, an error is reported

    Time:2020-1-27

    In background management, Vue is used with elementui, and Axios plug-in is used as the request method. When using the drop-down box, because I need to get other values in the selected options, I need to pass in the object. I didn’t read the document in the select drop-down box very carefully. Baidu has read […]

  • Using webpack dev server to create a mock server

    Time:2020-1-25

    Project address: https://github.com/yuanyuansh When developing web applications based on API interaction and separation of front and back ends, we often encounter several problems: The front page has been arranged, but the back interface is not ready We want the server to return specific types of data to test whether a page has problems under specific […]

  • JWT authentication of Vue route

    Time:2020-1-1

    JWT authentication of Vue route 1、 JWT identity authentication introduction JSON Web Token(JWT)It’s the most popularCross domainCompared with session mechanism, authentication solution,The server does not need to save any session dataThat is to say,The server is stateless, which makes it easier to implement the extension. JWT is actually a token, and the server willmetadata、Specified secretConductSign […]

  • Note: nginx agent Axios request and precautions

    Time:2020-1-1

    Recently, I wrote a small demo. Because I used the online data of a large factory and the interface was cross domain restricted, I used nginx agent to solve these problems. 1. Nginx.conf configuration information Becausenginx.confThere are many configuration information, this article only focuses on the followingaxiosAnd static resource request settings. By the way, I […]

  • JavaScript asynchrony and promise

    Time:2019-12-18

    Synchronous asynchronous series article recommendationOn JavaScript asynchronyCallback in JavaScript asynchronyJavaScript asynchronous promise. All(), promise. Race(), promise. Finally()JavaScript asynchronous promise. Resolve(), promise. Reject()Promise then and catch of JavaScript asynchronyAsynchronous JavaScript async (1)Asynchronous JavaScript (2)JavaScript asynchronous practiceJavaScript asynchronous Summary Archive We said that the most common way to deal with JavaScript asynchrony is through callback function, which […]

  • JavaScript asynchronous promise. All(), promise. Race(), promise. Finally()

    Time:2019-12-17

    Synchronous asynchronous series article recommendationOn JavaScript asynchronyCallback in JavaScript asynchronyJavaScript asynchrony and promiseJavaScript asynchronous promise. Resolve(), promise. Reject()Promise then and catch of JavaScript asynchronyAsynchronous JavaScript async (1)Asynchronous JavaScript (2)JavaScript asynchronous practiceJavaScript asynchronous Summary Archive Today we’re going to talk about promiseThere are many articles about the use of promise API on the Internet. In order […]

  • Ajax fetch and Axios (continuously updated…)

    Time:2019-12-9

    Ajax fetch and Axios (continuously updated…) Sorting out knowledge points AJAX is not the specification of JavaScript, it is just an abbreviation of “invention” of a friend: asynchronous JavaScript and XML, which means to execute asynchronous network requests with JavaScript. Javascript code is executed by single thread. Due to this “defect”, all network operations and […]

  • Axios. All() solves concurrent requests

    Time:2019-11-29

    Introduction:axios.all()、axios.spread()Two auxiliary functions are used to process multiple requests sent at the same time, which can implement some logic after multiple requests are completed. Note: this method isaxiosStatic method, notaxiosInstance method! First downloadaxios npm install axios –sava-dev staymina.jsIntroduce inaxiosBecause it does not belong tovueFamily bucket, so it’s attached tovueOn the prototype, realize global use main.js […]

  • Using API auto generation tool to optimize front-end workflow

    Time:2019-11-25

    In the work, our front-end workflow generally starts after the front and back end negotiate the API document, then we do mock simulation data for the API document, and then we use the mock to develop it. After the back-end development, we change the base URL of the API data to switch to the formal […]

  • Make an HTTP request support interceptor

    Time:2019-11-24

    Recently, I want to use the full JS system to write and learn from the front and back, so I created a set of todolist project hands-on. Currently, only the back-end demo has been written, and the front-end is using Vue. And prepare to write it again later with react and fluent.This projectBackend demo premise […]