Skip to content

Commit

Permalink
Allow credentials override
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoemans committed Dec 2, 2022
1 parent 5b2edba commit 24493df
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/spot.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/fetch-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const fetchMiddleware = (api: MiddlewareAPI) => (next: Dispatch) => async
const response = await fetch(url, {
...defaultFetchConfig,
method: action?.config?.method ?? 'GET',
credentials: action?.config?.credentials ?? 'same-origin',
headers: {
...defaultFetchConfig.headers,
authorization: action.config?.authorization || '',
Expand Down Expand Up @@ -89,6 +90,7 @@ export const fetchMiddleware = (api: MiddlewareAPI) => (next: Dispatch) => async
const response = await fetch(url, {
...defaultFetchConfig,
method: action?.config?.method ?? 'POST',
credentials: action?.config?.credentials ?? 'same-origin',
body: JSON.stringify(action.payload.params),
headers: {
...defaultFetchConfig.headers,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type ActionType = 'SETUP' | 'ERROR' | 'QUERY' | 'COMMAND' | 'QUERY_COMPLE
export interface ActionConfig {
method?: string;
authorization?: string;
credentials?: RequestCredentials;
}

export interface Action {
Expand Down

0 comments on commit 24493df

Please sign in to comment.