axios

Download zip with axios and unzip with adm-zip in memory (electron app)

安稳与你 提交于 2021-02-10 23:28:00
问题 I need to download a file with axios and unzip it in memory in an electron app. I read in some SO threads (e.g.), that adm-zip supports byte buffer constructor, but I can not see this in the docs. When I extract the content, it behaves like the array is empty, but it is not. It just does create a file and does not throw any errors I do not want to use request , as the api is marked deprecated. My code is this: const axios = require("axios"); const AdmZip = require('adm-zip'); const url =

why I can't make search request to my Elastic Enterprise Search app using axios?

馋奶兔 提交于 2021-02-10 21:25:30
问题 so I want to make search request to my elastic enterprise search app using guide from the documentation in here , I don't want to use elastic node JS client, but I want to make http request using axios. here is the code I use const url = "https://XXXXXXX38ce49e5aff1aa238e6f9195.ent-search.asia-southeast1.gcp.elastic-cloud.com/api/as/v1/engines/events/search" const headers = {"Authorization": "Bearer search-qpz4bu5o7ubb8j31r15juyrh"} const jsonData = { query: "hello there" } try { const {data}

why I can't make search request to my Elastic Enterprise Search app using axios?

萝らか妹 提交于 2021-02-10 21:21:40
问题 so I want to make search request to my elastic enterprise search app using guide from the documentation in here , I don't want to use elastic node JS client, but I want to make http request using axios. here is the code I use const url = "https://XXXXXXX38ce49e5aff1aa238e6f9195.ent-search.asia-southeast1.gcp.elastic-cloud.com/api/as/v1/engines/events/search" const headers = {"Authorization": "Bearer search-qpz4bu5o7ubb8j31r15juyrh"} const jsonData = { query: "hello there" } try { const {data}

How to read data from axios response through module.exports?

。_饼干妹妹 提交于 2021-02-10 20:14:00
问题 I need to read data from axios response through module.export. This is my data: http://localhost:8001 { "name":"Nama Nih", "desc":"Sekolah Terpadu Al-Qudwah - Yayasan Islam Qudwatul Ummah", "prefix":"alqudwah", "footerText":"Yayasan Islam Qudwatul Ummah | All Rights Reserved 2020", "logoText":"Al-Qudwah", "needLogin":false } I call data from axios with this code: brand.js var axios = require('axios'); module.exports = axios.get('http://localhost:8001', { headers: { 'Access-Control-Allow

Vue.js / Vuex + axios sends multiple PUT Request

允我心安 提交于 2021-02-10 19:59:15
问题 The user on my SPA is able to add/update and delete groups. I've set up a Vuex store and an API helper module. In the EditGroup component, a method gets executed when the user press "save changes". The issue is, axios sends 5 to 20 PUT requests but the method gets executed only once. On a GET, POST or DELETE request axios sends one request. In my EditGroup component: saveSelected : function () { this.$store.dispatch(ACTION_PUT_GROUP, { data : this.selected }); }, In my Vuex store:

React: use axios to post state to MongoDB

心不动则不痛 提交于 2021-02-10 19:33:18
问题 I am trying to post the states as data to MongoDB through Express and Node with Axios. class App extends React.Component { constructor(props){ super(props) this.state={ items: [{ desc:"Manage", price: 5000, purchased: false, }, { desc:"Deliver", price: 2000, purchased: false, }, { desc:"Market", price: 4000, purchased: false, } ], data:null, DisabledButton: true } } getAddedItems(){ return this.state.items.filter(item => item.purchased) } componentDidMount() { this.callApi() .then(res => this

React: use axios to post state to MongoDB

自古美人都是妖i 提交于 2021-02-10 19:32:22
问题 I am trying to post the states as data to MongoDB through Express and Node with Axios. class App extends React.Component { constructor(props){ super(props) this.state={ items: [{ desc:"Manage", price: 5000, purchased: false, }, { desc:"Deliver", price: 2000, purchased: false, }, { desc:"Market", price: 4000, purchased: false, } ], data:null, DisabledButton: true } } getAddedItems(){ return this.state.items.filter(item => item.purchased) } componentDidMount() { this.callApi() .then(res => this

React: use axios to post state to MongoDB

柔情痞子 提交于 2021-02-10 19:32:13
问题 I am trying to post the states as data to MongoDB through Express and Node with Axios. class App extends React.Component { constructor(props){ super(props) this.state={ items: [{ desc:"Manage", price: 5000, purchased: false, }, { desc:"Deliver", price: 2000, purchased: false, }, { desc:"Market", price: 4000, purchased: false, } ], data:null, DisabledButton: true } } getAddedItems(){ return this.state.items.filter(item => item.purchased) } componentDidMount() { this.callApi() .then(res => this

React/redux: Not saving in state as intended

给你一囗甜甜゛ 提交于 2021-02-10 18:10:34
问题 I am building a review app. I am using json-server to do post request. My database looks like this [{ "id": 5, "name": "Tom Cruise", "image": "http://placeholder.pics/svg/300x200/000000", "title": "Hiring Manager", "employeeId": "22222222", "funFact": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",

Axios Post request returns 204 No Content Status. What do I need to change to get a 201/persist the data?

試著忘記壹切 提交于 2021-02-10 18:04:51
问题 When locally attempting to make a POST request with Axios on my NodeJS front-end app to my .NET core local server, the server returns a 204 and the axios request returns a pending promise. What do I need to change to achieve a 201 created status/persist the record? When I try a post request in Postman it works perfectly, but my app however, behaves differently. axios request: export const postStudent = (firstName: string, lastName: string, yearLevel: string) => { return axios .post( `$