J
J
jspie2017-08-23 14:20:00
linux
jspie, 2017-08-23 14:20:00

How to get request response in Axios?

Good afternoon, how to get a response through axios with code 409? In the browser, I receive a JSON object response. In axios, catch is triggered, but returns nothing but the text: Error: Request failed with status code 409.

onSignUp(user){
    return axios.post(`/profile`, user)
      .then((res)=>{
                          console.log("AXIOS: " +  res);
      })
      .catch((err)=>{
        console.log("AXIOS: " +  err);
      });

Answer the question

In order to leave comments, you need to log in

6 answer(s)
N
nrgian, 2019-04-28
@nrgian

Find a distribution that supports your device and install.
Or develop this distribution yourself
If you don't find and create this distribution, then you can't.
Phone, not computer.
Computer Linux includes a lot of drivers for almost all occasions.
But for phone hardware, as a rule, drivers are not open and not published.

A
Armenian Radio, 2019-04-28
@gbg

If you have a rooted phone, try Linux Deploy.
It allows you to put a Linux distribution in the chroot of the regular kernel, so that you still have a regular shell on your phone, but desktop Linux also appears.
For phones on x86, it becomes possible to run software from vend through wine. That's how I played Age of empires.

D
Dim Boy, 2019-04-28
@twix007

study w3bsit3-dns.com with the theme of your smartphone.

R
rPman, 2019-04-28
@rPman

With a 99% chance, if you run linux on an android device, you will have problems with peripheral support (wifi / bluetooth / touch screen / sound / and most importantly graphics support), in some cases you may be able to solve something in semi-manual mode (t .i.e. do not rely on automatic resolution of problems, you will have to dig and possibly compile, and this gives rise to many problems such as update support, etc.).
Install linux in chroot, I remember exactly there were xwin servers for android with full work and access to equipment, i.e. you will not lose the device’s performance (at least through android) and at the same time you will have the opportunity to run linux arm applications, in some cases directly from ready-made images with update support and so on.

A
Alexander Aksentiev, 2017-08-23
@Sanasol

https://github.com/mzabriskie/axios#handling-errors
right on the main page

V
vaskadogana, 2017-08-23
@vaskadogana

.then((res)=>{
   console.log (res.data) - это и есть ответ сервера
}

you need to use call back or a promise
or do what you want directly in then (the same promise only from axios)
like
onSignUp(user){
   axios.post(`/profile`, user)
      .then((res)=>{
                          console.log("AXIOS: " +  res);
if(res.data == "все окей"){
alert('точняк')
document.location.href = 'urlafterautorization'
}
      })
      .catch((err)=>{
        console.log("AXIOS: " +  err);
      });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question