import axios from "axios" ; import { API , IS_DEV } from "../config" ; const axiosInstance = axios . create ( { timeout : 200000 } ) ; const checkStatus = hosts => new Promise ( ( resolve , reject ) => { if ( IS_DEV ) return resolve ( true ) ; Promise . all ( hosts . map ( host => axiosInstance . get ( `${ host }${ API . V2_STATUS_PATH }` ) . then ( ( { data : { available } } ) => available ) ) ) . then ( availabilities => { const available = availabilities . every ( Boolean ) ; if ( ! available ) { } resolve ( available ) ; } ) . catch ( err => { resolve ( false ) ; } ) ; } ) ; export default { checkStatus } ;