Answers for "how to cancel request using axios cancel token"

0

how to cancel request using axios cancel token

const source = CancelToken.source();
  const timeout = setTimeout(() => {
    source.cancel();
    // Timeout Logic
  }, 10000);
  
  axios.get(ip + '/config', {cancelToken: source.token}).then((result) => {
    // Clear The Timeout
    clearTimeout(timeout);

    // Handle your response
  });
Posted by: Guest on September-11-2021

Browse Popular Code Answers by Language