Created
February 24, 2020 08:17
-
-
Save windate3411/4e5e148d49630bbbdcdbe05c2550bd77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
// 告訴axios你創立的實體要以什麼作為baseURL,特別注意URL需要大寫,這是axios的屬性之一 | |
const baseURL = 'https://jsonplaceholder.typicode.com' | |
const axiosInstance = axios.create({ | |
baseURL | |
}) | |
// 輸出你所創立的axios實體 | |
export const apiHelper = axiosInstance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment