generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99fb570
commit 3666ca1
Showing
3 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
/** | ||
* Returns Fetch API cache options that force a reload. | ||
* @returns Force reload cache options. | ||
*/ | ||
export function getFetchCacheOptionsForceReload() { | ||
return { cache: 'reload' }; | ||
} | ||
|
||
/** | ||
* Detects the navigation type of the current page in browser. | ||
* If the current page was reloaded (e.g. by user), force a cache reload of items | ||
* fetched via Fetch API as well (e.g. footer, header, Query Index). | ||
* @returns Options for Fetch API. | ||
*/ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export function getFetchCacheOptions() { | ||
const navigationType = window.performance.getEntriesByType('navigation')[0]?.type; | ||
if (navigationType === 'reload') { | ||
return getFetchCacheOptionsForceReload(); | ||
} | ||
return {}; | ||
} | ||
|
||
/** | ||
* Returns Fetch API cache options that force a reload. | ||
* @returns Force reload cache options. | ||
*/ | ||
export function getFetchCacheOptionsForceReload() { | ||
return { cache: 'reload' }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters