“Jak złożyć żądanie pocztowe od Axios” Kod odpowiedzi

Axios wysyłać dane pocztowe

// Send a POST request
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  },
  headers: {'Authorization': 'Bearer ...'}
});
Victor Grk

Jak złożyć żądanie pocztowe od Axios

import axios from 'axios';

async makeRequest() {
  try {
    const response = await axios.post('your_request_url_here', {
    // Enter your body parameters here
    });
  }
  catch(e) {
    // Handle your error here
  }
}

// Axios returns a promise and hence you can use .then(), .catch for error
// handling if you don't want to use async/await(use try/catch for error 
// handling)
Smiling Skunk

AXIOS API Post

import qs from 'qs';
const data = { 'bar': 123 };
const options = {
  method: 'POST',
  headers: { 'content-type': 'application/x-www-form-urlencoded' },
  data: qs.stringify(data),
  url,
};
axios(options);
Amused Ant

Odpowiedzi podobne do “Jak złożyć żądanie pocztowe od Axios”

Pytania podobne do “Jak złożyć żądanie pocztowe od Axios”

Więcej pokrewnych odpowiedzi na “Jak złożyć żądanie pocztowe od Axios” w JavaScript

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

Przeglądaj inne języki kodu