axios

Get {“message”:“Unauthenticated.”} when sending POST request to laravel server

独自空忆成欢 提交于 2021-02-10 14:48:22
问题 I have a problem with sending POST request from Vue axios to laravel server with sanctum. Firstly I'm getting token. My route of api.php Route::post('/get_token', function (Request $request) { $request->validate([ 'email' => 'required|email', 'password' => 'required', 'device_name' => 'required' ]); $user = User::where('email', $request->email)->first(); if (! $user || ! Hash::check($request->password, $user->password)) { throw ValidationException::withMessages([ 'email' => ['The provided

Get {“message”:“Unauthenticated.”} when sending POST request to laravel server

試著忘記壹切 提交于 2021-02-10 14:47:22
问题 I have a problem with sending POST request from Vue axios to laravel server with sanctum. Firstly I'm getting token. My route of api.php Route::post('/get_token', function (Request $request) { $request->validate([ 'email' => 'required|email', 'password' => 'required', 'device_name' => 'required' ]); $user = User::where('email', $request->email)->first(); if (! $user || ! Hash::check($request->password, $user->password)) { throw ValidationException::withMessages([ 'email' => ['The provided

Cannot read property `.then` of undefined with axios and react in actions

心不动则不痛 提交于 2021-02-10 06:18:19
问题 I am using axios in an action and trying to call that action with a chaining action. I will show what I am trying to do here: this.props.fetchOffers().then(() => { this.props.filter(this.props.filterOption); }); But I get an error: Cannot read property 'then' of undefined . What I do not get is that right below this function I have another action that is doing this exact same thing and working just fine. this.props.sortOffers(value).then(() => { this.props.filter(this.props.filterOption); });

Cannot read property `.then` of undefined with axios and react in actions

非 Y 不嫁゛ 提交于 2021-02-10 06:17:33
问题 I am using axios in an action and trying to call that action with a chaining action. I will show what I am trying to do here: this.props.fetchOffers().then(() => { this.props.filter(this.props.filterOption); }); But I get an error: Cannot read property 'then' of undefined . What I do not get is that right below this function I have another action that is doing this exact same thing and working just fine. this.props.sortOffers(value).then(() => { this.props.filter(this.props.filterOption); });

How to Fix '422 Unprocessable Entity' when sending a POST request to Redmine API?

不想你离开。 提交于 2021-02-10 05:58:26
问题 I am trying to create a wiki page using redmine rest api. The Authentication was succeeded, however the wiki page is not being created because of a 422 error. The Redmine documentation says: "When trying to create or update an object with invalid or missing attribute parameters, you will get a 422 Unprocessable Entity response. That means that the object could not be created or updated." But I can seem to find out where I have mess up. The PROBLEM CAME UP WHEN I DID THE SECOND REQUEST- "PUT

How can I call a function after grecaptcha.execute() has finished executing - triggered by an event?

☆樱花仙子☆ 提交于 2021-02-08 14:58:13
问题 Currently grecaptcha.execute is being executed on page load as in the first JS example below. If reCAPTCHA challenge is triggered this happens when the page has loaded. Ideally this would happen when the form submit button is clicked instead. So I've tried this by moving this into the submit event (second JS example) and put the axios function into a promise. It's submitting before grecaptcha.execute has finished executing. What is it that I'm not understanding here? My first experience with

Image upload to s3 does not render

╄→尐↘猪︶ㄣ 提交于 2021-02-08 10:00:38
问题 I am using Expo Image Picker to send a cropped image to s3. The file is being uploaded, but it does not render as an image as its not recognised as one. If I took the blob data and use it in a base64 to image encoder I get the image, so it must be mime or encoding based, here is what I have. I invoke the Expo Image Picker with; let pickerResult = await ImagePicker.launchImageLibraryAsync({ allowsEditing: true, aspect: [1, 1], base64: true, exif: false, }); The params I use to create the

Image upload to s3 does not render

那年仲夏 提交于 2021-02-08 09:59:10
问题 I am using Expo Image Picker to send a cropped image to s3. The file is being uploaded, but it does not render as an image as its not recognised as one. If I took the blob data and use it in a base64 to image encoder I get the image, so it must be mime or encoding based, here is what I have. I invoke the Expo Image Picker with; let pickerResult = await ImagePicker.launchImageLibraryAsync({ allowsEditing: true, aspect: [1, 1], base64: true, exif: false, }); The params I use to create the

axios response headers missing data when running in vuejs app

社会主义新天地 提交于 2021-02-08 09:44:26
问题 I have simple vuejs application. In the main.js I have something like: import Vue from "vue"; import App from "./App.vue"; import router from "./router/routes"; import store from "./store/root"; import vuetify from "./plugins/vuetify"; import { RootActions } from "./constants"; import axios from "axios"; axios.get("https://api.github.com/users/mzabriskie").then(function(response) { console.log({ headers: response.headers }); }); In the chrome console log I got these: However in https://runkit

laravel simple axios with argument

喜欢而已 提交于 2021-02-08 07:45:27
问题 I'm trying to set axios request but always getting missing argument, but not sure how can I pass it can someone explain why this wont work? my route: (web.php) Route::post('/api/setSuccessMessage', 'API\SessionsController@setSuccessMessage'); my controller: (Controllers/API/SessionsController.php) class SessionsController extends Controller { public static function setSuccessMessage($key, $value) { session()->put($key ,$value); }... and my vueJS axios call (resources/assets/components/Login