axios

how to submit “multipart/form-data” from VueJs

亡梦爱人 提交于 2020-06-12 07:29:08
问题 I am using VueJs / axios in frontend and multer in nodejs for a simple file upload to work. So far all tries has been unsuccessful. While this can be achieved in 100 ways in angular 1/2 using ng-upload and other similar plugins. But VueJs seems to be lacking this basic functionality. Based on my research axios doesnt support "multipart/form-data". Ref https://github.com/mzabriskie/axios/issues/789 . multer and other nodejs libraries seems to work with "multipart/form-data" seamlessly from

How to ignore SSL certificate validation in node requests?

走远了吗. 提交于 2020-06-12 07:19:48
问题 I need to disable peer SSL validation for some of my https requests using node.js Right now I use node-fetch package which doesn't have that option, as far as I know. That should be something like CURL's CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false Does any networking package allow to do so? Is there a way to skip SSL validation in axios maybe? 回答1: Axios doesn't address that situation so far - you can try: process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; BUT THATS A VERY

Can't access Vuex storage mutation inside Axios interceptor

落爺英雄遲暮 提交于 2020-06-12 06:04:10
问题 EDIT: this question was very chaotic so I basically rewrite it with same code example and same scenerio. When 401 error is send in response from server I'm trying to .commit from interceptor to my vuex storage: import axios from 'axios'; import { store } from '../store/store'; export default function execute() { axios.interceptors.request.use(function(config) { const token = store.state.token; if(token) { config.headers.Authorization = `Bearer ${token}`; //console.log(config); return config;

Can't access Vuex storage mutation inside Axios interceptor

泪湿孤枕 提交于 2020-06-12 06:03:13
问题 EDIT: this question was very chaotic so I basically rewrite it with same code example and same scenerio. When 401 error is send in response from server I'm trying to .commit from interceptor to my vuex storage: import axios from 'axios'; import { store } from '../store/store'; export default function execute() { axios.interceptors.request.use(function(config) { const token = store.state.token; if(token) { config.headers.Authorization = `Bearer ${token}`; //console.log(config); return config;

Handling api calls in Redux with Axios

断了今生、忘了曾经 提交于 2020-06-09 08:23:10
问题 Good evening everybody! I'm a total beginner in React and Redux so please bear with me if this sounds totally stupid. I'm trying to learn how I can perform some API calls in Redux and it's not going all to well. When I console log the request from the action creator the promise value is always "undefined" so I'm not sure if I'm doing this correctly. My goal is to grab the information from the data inside the payload object and display them inside the component. I've been trying to get this to

SetState doesn't work with with data from server

杀马特。学长 韩版系。学妹 提交于 2020-06-07 07:11:26
问题 Hi I'm programming a page with React hooks and I'm trying to set the data I get from the server in to the state. SOmehow it doesnt work. I get the data from the server, but i cant map it to the state. Any Ideas what the problem could be? const [workouts, setWorkouts] = React.useState([]); useEffect(() => { apiGet(fitnessaryEndPoints.workouts.getAllWorkouts) .then( response => { setWorkouts([...workouts, response.data]) console.log(response) console.log(workouts) } ).catch( error => { console

SetState doesn't work with with data from server

假装没事ソ 提交于 2020-06-07 07:11:10
问题 Hi I'm programming a page with React hooks and I'm trying to set the data I get from the server in to the state. SOmehow it doesnt work. I get the data from the server, but i cant map it to the state. Any Ideas what the problem could be? const [workouts, setWorkouts] = React.useState([]); useEffect(() => { apiGet(fitnessaryEndPoints.workouts.getAllWorkouts) .then( response => { setWorkouts([...workouts, response.data]) console.log(response) console.log(workouts) } ).catch( error => { console

React Props doesnt show info properly in the confirmation page

只愿长相守 提交于 2020-06-01 07:38:07
问题 I'm designing a form in React that has a main form builder (Create Job.js) and some form pages (AdditionalInfo.js) and (Confirmation.js) . this form had a tag input that allows you to choose tags from a drop-down list provided by an API. the selected items need to be shown later in the confirmation page. This is my main form builder that has props and functions: (CreateJob.js) state = { step:1, Title:'', requirements:'', Location:'', Benefits:'', Company:'', InternalCode:'', Details:'', Tags:

403 status from Firebase Cloud Function -> Google Books API

醉酒当歌 提交于 2020-06-01 05:41:21
问题 I'm currently working on creating a Firebase Cloud Function that retrieve a list of books from the NYTimes API and grabs some additional information from the Google Books API. By using the following URL : "https://www.googleapis.com/books/v1/volumes?q=isbn:&key=" I'm able to retrieve books' details based on an ISBN. My FREE quota for Google Books API is 1000 request per day and 100 request every 100 seconds per user. I'm only sending 15 requests and my current quota is below 200. My key is

403 status from Firebase Cloud Function -> Google Books API

南楼画角 提交于 2020-06-01 05:40:05
问题 I'm currently working on creating a Firebase Cloud Function that retrieve a list of books from the NYTimes API and grabs some additional information from the Google Books API. By using the following URL : "https://www.googleapis.com/books/v1/volumes?q=isbn:&key=" I'm able to retrieve books' details based on an ISBN. My FREE quota for Google Books API is 1000 request per day and 100 request every 100 seconds per user. I'm only sending 15 requests and my current quota is below 200. My key is