import fetchRPC from '.';
export default {
  title: 'Abort test',
};

export const timeout = () => {
  try {
    const r = fetchRPC(
      'n.clusters.GetCoverage',
      {},
      {
        timeout: 100,
      }
    );
  } catch (e) {
    console.log(e);
  }
  // .catch(error => console.warn(error));
};

const abort = () => {
  try {
    const r = fetchRPC('n.clusters.GetCoverage', {});
    r.abort();
  } catch (e) {
    alert(e);
  }
};

export const timeoutTest = () => <button onClick={timeout}>Test timeout</button>;
export const abortTest = () => <button onClick={abort}>Test abort</button>;
