import Response from '~/Contracts/ClientResponse'; import Guard from '~/Guards/Guard'; class BadStatusGuard extends Guard { /** * * * @param {object} response * @return {boolean} */ public check(response: Response) { return response.status === 200; } /** * * * @return {Trending | null} */ public contingency() { const trending = this.storage.get(); console.error('TrendingService - Bad status code found in response.'); if (! trending) { console.warn('TrendingService - No previous trending data available in local-storage.'); } return trending; } /** * * * @return {boolean} */ public retry() { return true; } } export default BadStatusGuard;