-
Notifications
You must be signed in to change notification settings - Fork 6
Confirmation modal for new both DREF Operational Update and final report #2048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: project/dref-translation
Are you sure you want to change the base?
Changes from 4 commits
4ba4569
c8ffb35
dc5a761
d5fa320
c8390d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,7 @@ function GoSingleFileInput<T extends NameType>(props: Props<T>) { | |
| // FIXME: fix typing in server (low priority) | ||
| // the server generated type for response and body is the same | ||
| body: (body) => body as never, | ||
| useCurrentLanguageForMutation: true, | ||
|
||
| onSuccess: (response) => { | ||
| const { id, file } = response; | ||
| onChange(id, name); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,9 @@ export interface AdditionalOptions { | |
| formData?: boolean; | ||
| isCsvRequest?: boolean; | ||
| enforceEnglishForQuery?: boolean; | ||
| // FIXME using the current language should be default behaviour so we might not need this. | ||
| useCurrentLanguageForMutation?: boolean; | ||
| enforceLanguageForMutation?: Language; | ||
| isExcelRequest?: boolean; | ||
| } | ||
|
|
||
|
|
@@ -167,6 +169,7 @@ export const processGoOptions: GoContextInterface['transformOptions'] = ( | |
| isExcelRequest, | ||
| enforceEnglishForQuery = false, | ||
| useCurrentLanguageForMutation = false, | ||
| enforceLanguageForMutation, | ||
| } = extraOptions; | ||
|
|
||
| const currentLanguage = getFromStorage<Language>(KEY_LANGUAGE_STORAGE) ?? 'en'; | ||
|
|
@@ -180,9 +183,15 @@ export const processGoOptions: GoContextInterface['transformOptions'] = ( | |
| if (method === 'GET') { | ||
| // Query | ||
| defaultHeaders['Accept-Language'] = enforceEnglishForQuery ? 'en' : currentLanguage; | ||
| } else { | ||
| } else if (method === 'POST' || method === 'PUT' || method === 'PATCH') { | ||
| // Mutation | ||
| defaultHeaders['Accept-Language'] = useCurrentLanguageForMutation ? currentLanguage : 'en'; | ||
| if (isDefined(enforceLanguageForMutation)) { | ||
| defaultHeaders['Accept-Language'] = enforceLanguageForMutation; | ||
| } else if (useCurrentLanguageForMutation) { | ||
| defaultHeaders['Accept-Language'] = currentLanguage; | ||
| } else { | ||
| defaultHeaders['Accept-Language'] = 'en'; | ||
| } | ||
|
Comment on lines
+186
to
+194
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to add default fallback as well |
||
| } | ||
|
|
||
| if (formData) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pass this down as prop and use it only where necessary, this might affect the other places where input is currently being used