From 75622393ff10972ce95ebc1c532aab1869e3a307 Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Sun, 25 Aug 2024 15:53:55 +0200 Subject: [PATCH] Add store.js to core assets --- rdmo/core/assets/js/utils/store.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rdmo/core/assets/js/utils/store.js diff --git a/rdmo/core/assets/js/utils/store.js b/rdmo/core/assets/js/utils/store.js new file mode 100644 index 0000000000..d30203fd59 --- /dev/null +++ b/rdmo/core/assets/js/utils/store.js @@ -0,0 +1,14 @@ +import Cookies from 'js-cookie' +import isEmpty from 'lodash/isEmpty' + +const checkStoreId = () => { + const currentStoreId = Cookies.get('storeid') + const localStoreId = localStorage.getItem('rdmo.storeid') + + if (isEmpty(localStoreId) || localStoreId !== currentStoreId) { + localStorage.clear() + localStorage.setItem('rdmo.storeid', currentStoreId) + } +} + +export { checkStoreId }