diff --git a/rdmo/core/assets/js/utils/store.js b/rdmo/core/assets/js/utils/store.js new file mode 100644 index 000000000..d30203fd5 --- /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 }