Open
Description
I want access redux store in the file storage.js, because in the mod I am working we need to send a token (that is stored in redux store) in the API request header to get an asset in the function getAssetGetConfig()
:
getAssetGetConfig (asset) {
const mockToken = 'mocked-token';
return {
method: 'GET',
url: `${BASE_API_URL}/md/api/assets/${asset.assetId}.${asset.dataFormat}`,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${mockToken}`,
}
}
}
I tried creating a HOC that returns the token (see code below) but I was not able to connect it to storage.js
. I think is because it is exporting an instance.
const StorageWithToken = withToken(Storage);
const storage = new StorageWithToken();
export default storage;
Thank you 🙇♀️
Metadata
Metadata
Assignees
Labels
No labels