UNPKG

proactive-http-fetch

Version:

Proactive http fetch package

17 lines (13 loc) 450 B
import { FetchError } from 'cross-fetch/polyfill'; export class BrowserLocation { public redirect(response: Response | FetchError) { if (response instanceof Response === false) return; if (response.status === 401 || response.status === 403) this.change(response.url); } private change(url: string) { if (!!window.location) window.location.href = url; } }