From 7024ae735f76447f6341730908e65bc66651df6e Mon Sep 17 00:00:00 2001 From: Rishav Bharti Date: Fri, 24 Jun 2022 12:10:44 +0530 Subject: [PATCH] Fix `constants` import path & remove `Math.floor()` call in `deleteCache` --- src/app/slice/feedSlice.js | 6 +++++- src/utils/index.js | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/slice/feedSlice.js b/src/app/slice/feedSlice.js index 28e4c79..3b867f1 100644 --- a/src/app/slice/feedSlice.js +++ b/src/app/slice/feedSlice.js @@ -5,7 +5,11 @@ import { } from '@reduxjs/toolkit'; import axios from 'axios'; -import { FEED_CACHE_NAME, CACHED_TIME_HEADER, CACHE_DURATION } from 'constants'; +import { + FEED_CACHE_NAME, + CACHED_TIME_HEADER, + CACHE_DURATION, +} from '../../constants'; import { deleteCache } from 'utils'; import { BASE_URL, config } from 'services'; diff --git a/src/utils/index.js b/src/utils/index.js index c58caf2..5f75fe5 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -17,9 +17,7 @@ export const deleteCache = async function ( url ) { try { - const cachedTime = Math.floor( - cachedResponse.headers.get(CACHED_TIME_HEADER) - ); + const cachedTime = cachedResponse.headers.get(CACHED_TIME_HEADER); const timeElapsed = (Date.now() - cachedTime) / 1000;