axios

Display in v-for laravel-vue

ε祈祈猫儿з 提交于 2019-12-13 03:14:08
问题 EDITED: I'm using Vue.js and I'm having an issue that my object JSON-string doesn't show. The problem is the object string doesn't display in v-for. JS var app = new Vue({ el: '#ob-rapper', data:{ items:[], }, mounted: function mounted(){ this.getVueItems(); }, methods:{ getVueItems: function getVueItems() { var _this = this; axios.get('/viewrequestsample').then(function (response) { _this.items = response.data; }); } } }); Controller: public function viewRequestSample(){ $data = OBMaster:

How to obtain the ID Value of a select populated with axios and Vue

杀马特。学长 韩版系。学妹 提交于 2019-12-13 03:02:01
问题 I have a <select id="ddlTipoUsuario" class="form-control" > <option v-for="tipoUsuario in tipoUsuarios">{{tipoUsuario.Tipo}}</option> </select> populated with Vue and axios, but I need to obtain the ID Value to post in another table. In the response.data returns these values: [ { "TipoUsuarioId": 1, "Tipo": "Administrador" }, { "TipoUsuarioId": 2, "Tipo": "Usuario" } ] To populate my <select> i use this code: export default { data() { return { tipoUsuarios:[], } }, method: { getTipoUsuario()

Request body is not being passed from axios get call to Django Rest Framework

寵の児 提交于 2019-12-13 02:55:39
问题 I have an issue while sending get request with a body in axios. It does not pass the body of the request to the backend. Axios code looks like below const FunctionName = (environment, page_num) => { axios.get(API_URL, { params: { environment, page_num }, }).then(res => { console.log(res); }).catch(err => { console.log(err.response.data); }); } I'm using Django as my backend and I'm receiving empty body i.e {} which causes bad request sent to the backend. I went through several stack overflow

Empty Image is uploadded

元气小坏坏 提交于 2019-12-13 02:50:35
问题 Image Upload to wordpress is uploading empty image I am working on a mobile application consumes wordpress API. My application uses Nativescript-Vue Framework. I need to upload multiple images to wordpress using remote WP-API. var data=[]; const params = new FormData(); //params.append('file', this.value); this.product.images.forEach(i => { params.append('file',i.src); console.log(i.src); }); const axiosInstance = axios.create({ baseURL: 'https://mah.ttawor.com/wp-json/wp/v2/', timeout: 5000,

axios set default headers dynamically

喜欢而已 提交于 2019-12-13 02:31:21
问题 I want to set a header that sent with each request: axios.defaults.headers.common = { Accept: 'application/json', 'X-CSRF-TOKEN': store.state.csrf }; This is only evaluated at the page load. I would like it to be dynamic since the csrf value may change later on. Something like: axios.defaults.headers.common = { Accept: 'application/json', 'X-CSRF-TOKEN': () => store.state.csrf }; However this does not work. 回答1: You can overwrite/extend the defaults at any time: // set defaults... // do

API calls with axios inside a React app bundled in Electron is returning 400

若如初见. 提交于 2019-12-13 02:19:37
问题 Just a quick question: I'm building a React/Electron app and inside the React app I've got a few async/await calls to an API. These calls are made with axios and work fine when in development. When the app is wrapped in Electron, the requests return with a "400 Headers required" error. When running a dev version of React it call the api correctly. Any idea why this is happening? I came across the WebRequest Electron method https://electronjs.org/docs/api/web-request. It looks like I could

Having the same value of Price and Total column using ReactJS

青春壹個敷衍的年華 提交于 2019-12-13 01:13:42
问题 I want after I select the product name, The price will be displayed and when I put the quantity The total column will be displayed also. My issue is when I select the product name, the same value of the price will be displayed for others row and the total column has NaN as you see on the figure as below: My code is : class AjouterFacture extends Component { constructor(props) { super(props); this.state = { rowData: [], Produits: [], Quantite: "", Prix: [], lineItemData: [], id: 0,

Timeout on Axios Requests

大兔子大兔子 提交于 2019-12-13 01:12:58
问题 Our site currently has a filter feature that fetches new data via axios depending on what is being filtered. The issue is that the filter is done on real time and every change made via react causes an axios request. Is there a way to put a timeout on the axios request so that I only fetch the last state? 回答1: I would suggest using debounce in this case to trigger API call after a specified millisecond of user input. But just in case you need to add a timeout during axios call, this can be

error status 401 error unauthenticated laravel passport

巧了我就是萌 提交于 2019-12-13 00:55:54
问题 This is my first time implementing laravel passport This is my config/auth.php 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'passport', 'provider' => 'users', ], ], and this is where my routes/api.php that are guarded by auth:api Route::group(['middleware' => ['auth:api']], function () { Route::resource('users','Users\AdminUsersController')->except([ 'create', 'edit' ]); }); and this is how I fetch the api fetchUsers: async function(page_url

data returned by YouTube API seems immutable?

谁说胖子不能爱 提交于 2019-12-13 00:34:07
问题 onSearch = async () => { const query = qs.stringify({ ...API_QUERY_PARAMS, q: this.state.searchString }); const url = `https://www.googleapis.com/youtube/v3/search?${query}` const { data } = await axios.get(url); data.items.forEach(async vid => { let id = vid.id.videoId; //Individual video ID const individualQuery = qs.stringify({ ...INDIVIDUAL_API_QUERY_PARAMS, id }); const individualURL = `https://www.googleapis.com/youtube/v3/videos?${individualQuery}`; const { data } = await axios.get