diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..c3dc0fc --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,53 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8d0f972 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/spot.iml b/.idea/spot.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/spot.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/fetch-middleware.ts b/src/fetch-middleware.ts index d74bb26..df8262a 100644 --- a/src/fetch-middleware.ts +++ b/src/fetch-middleware.ts @@ -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 || '', @@ -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, diff --git a/src/types.ts b/src/types.ts index 0906f2e..2731440 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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 {