“Axios Uzyskaj kod stanu” Kod odpowiedzi

axios próbuj złapać status błędu Cocxe

     try {
     	await axios.get('/bad-call')
     } catch (error) {
        const err = error as AxiosError
        if (err.response) {
           console.log(err.response.status)
           console.log(err.response.data)
        }
        this.handleAxiosError(error)
     }
Spotless Snail

Axios Uzyskaj kod stanu

axios.get('/foo')
  .catch(function (error) {
    if (error.response) {
      console.log(error.response.data);
      console.log(error.response.status);
      console.log(error.response.headers);
    }
  });
Fusinato

Axios Uzyskaj kod stanu

axios.get('/api')
	.catch(function (error) {
    	if (error.response) {
      		console.log(error.response.status);
    	}
	});
GutoTrosla

Odpowiedzi podobne do “Axios Uzyskaj kod stanu”

Pytania podobne do “Axios Uzyskaj kod stanu”

Więcej pokrewnych odpowiedzi na “Axios Uzyskaj kod stanu” w TypeScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu