UNPKG

4m-wallet-adapter

Version:
24 lines (17 loc) 417 B
'use strict'; const axios = require('axios'); const { SALMON_API_URL } = require('../constants/environment'); let promise; const getSwitches = async () => { if (promise) { return promise; } promise = axios.get(`${SALMON_API_URL}/v1/switches`).then(({ data }) => data); try { return await promise; } catch (error) { promise = null; throw error; } }; module.exports = { getSwitches };