Category : axios

I am trying to intercept 401 errors in axios for protected routes, but I don’t seem to be able to pass a ‘real’ reference to the currentRoute object to check the meta attribute for protected status. main.js createApp(App) .use(store) .use(router) .provide(‘GStore’, GStore) .mount(‘#app’) router.js import registerInterceptor from ‘@/router/interceptor’ … registerInterceptor(router) export default router interceptor.js import ..

Read more

I was requesting for some help with the below error which is occurring in my React js Frontend in my Login Form after Submitting required details inside the form. Unhandled Rejection (TypeError): Cannot read property ‘data’ of undefined This is a screenshot Chrome of the error displayed on Chrome and the Chrome console It occured ..

Read more

I’m trying to render an image, but when I do a search, this happens: My App: import ‘./App.css’; import Button from ‘react-bootstrap/Button’; import ‘bootstrap/dist/css/bootstrap.min.css’; import axios from ‘axios’; import { Form } from ‘react-bootstrap’; import CSS from ‘./index.css’; import { useState, useEffect } from ‘react’; const user = ‘Mikael’; function App() { const [data, setData] ..

Read more

This part of code is not rendering, can someone please help me. The comments react variable is an array and is set: 0: {comment: {…}, subcomments: Array(0)} 1: {comment: {…}, subcomments: Array(0)} 2: {comment: {…}, subcomments: Array(0)} 3: {comment: {…}, subcomments: Array(0)} 4: {comment: {…}, subcomments: Array(0)} 5: {comment: {…}, subcomments: Array(0)} 6: {comment: {…}, ..

Read more

I have a function that gets data from a form when it is submitted and I am trying to make a post request using axios with this data here is my function (reactjs): const handelSubmit = (e) => { e.preventDefault(); const newFact = {Email, Fact, Source}; axios.post(‘https://www.examplesite.com/create’, { “data”: newFact}) .then(function (response) { console.log(response); }) ..

Read more

<noscript><strong>Javascript is enabled in your web browser on a specific site while implementing web crawling. If you disable JavaScript, this text will change.</strong></noscript> I checked that the same tag was added. For a site that includes this tag, even if you request to get the site url with axios, the html value does not come ..

Read more

I have deployed my reactapp to netlify, the backend api endpoint looks like http://31.64.97.124/apiusers the requests are working fine on localhost but when i delployed my frontend to server, on every fetch request it start giving below error. Mixed Content: The page at ‘https://blissful-lamport-78c1f5.netlify.app/’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://34.68.97.184/apiusers/login’. ..

Read more

I’m using axios and my backend is laravel/php. I should send an form-data like this: national_id:123 social_media[0][social_id]:1 social_media[0][username]:myuser my data: var social_media = [] let newSocial = { "social_id": 1, "username": myuser } social_media.push(newSocial) const data = { "national_id": national_id, "social_media": social_media, "image":image } my axios post: updateUser = (data) => { const headers = ..

Read more