UNPKG

@lfai/egeria-js-commons

Version:

Common module for storing static data such as key value objects, SVGs, icon mappings, API urls.

15 lines (14 loc) 499 B
import { logout } from '../authentication'; export function handleResponse(response) { if (!response.ok) { if ([401, 403].indexOf(response.status) !== -1) { logout(); } if ([401, 403, 404, 500, 501, 502, 503, 504].indexOf(response.status) !== -1) { const event = new CustomEvent('EGERIA_API_ERROR', { 'detail': response }); document.dispatchEvent(event); } return Promise.reject(response); } return response; }