Skip to content

Commit

Permalink
Don't mutate headers in setUploadOptions
Browse files Browse the repository at this point in the history
Enable ESLint rule to stop me from doing this again.
  • Loading branch information
mhoran committed Mar 10, 2024
1 parent c3ebea0 commit a16bd73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"settings": { "react": { "version": "detect" } },
"rules": {
"eqeqeq": "error",
"no-param-reassign": ["error", { "props": true }],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/no-unused-vars": [
"error",
Expand Down
3 changes: 2 additions & 1 deletion src/usecase/settings/UploadSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ const UploadSettings: React.FC<Props> = ({
const { headers, ...rest } = uploadOptionsState;
const headersObject = headers.reduce<Record<string, string>>(
(headers, [headerName, headerValue]) => {
if (headerName && headerValue) headers[headerName] = headerValue;
if (headerName && headerValue)
return { ...headers, [headerName]: headerValue };
return headers;
},
{}
Expand Down

0 comments on commit a16bd73

Please sign in to comment.