Skip to content

Commit c490b07

Browse files
hobbeswalshryanashcraft
authored andcommitted
Always add response headers to the redux store (amplitude#84)
* Always add response headers to the redux store * correcting typo and adding selector * Update tab size
1 parent 69690c3 commit c490b07

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/reducers/queries.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const queries = (state = initialState, action) => {
3737
isPending: false,
3838
lastUpdated: action.time,
3939
status: action.status,
40+
headers: action.responseHeaders,
4041
},
4142
};
4243
}

src/selectors/query.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export const status = (queriesState, queryConfig) => {
2626
}
2727
};
2828

29+
export const headers = (queriesState, queryConfig) => {
30+
if (queryConfig) {
31+
const queryKey = getQueryKey(queryConfig);
32+
33+
return get(queriesState, [queryKey, 'headers']);
34+
}
35+
};
36+
2937
export const lastUpdated = (queriesState, queryConfig) => {
3038
if (queryConfig) {
3139
const queryKey = getQueryKey(queryConfig);

0 commit comments

Comments
 (0)