-
Notifications
You must be signed in to change notification settings - Fork 44
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
🐛 Business services: Fix create/edit when owner is included #1418
Conversation
The `owner` field on the `BusinessService` payload needs to be a pure `Ref` object or it will be rejected by the REST API call. Adopt the same set of data transforms used in the application-form to handle getting the correct set of data. Related changes: - Business service related REST API functions updated to have the correct response types - Business service queries updated to pass REST API response and input values to `onSuccess()` and `onError()` handlers - `BusinessServiceForm` updated to use mutation response data to display the name of the business service in success messages - Refactored `business-service-form.tsx` to move all data access/mutation code to hook `useApplicationFormData() to logically divide concerns (data access v. UI handling) Resolves: https://issues.redhat.com/browse/MTA-1346 Signed-off-by: Scott J Dickerson <sdickers@redhat.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1418 +/- ##
=======================================
Coverage 41.24% 41.25%
=======================================
Files 138 138
Lines 4347 4349 +2
Branches 1005 1005
=======================================
+ Hits 1793 1794 +1
- Misses 2542 2543 +1
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
obj: BusinessService | ||
): Promise<BusinessService> => axios.put(`${BUSINESS_SERVICES}/${obj.id}`, obj); | ||
export const updateBusinessService = (obj: BusinessService) => | ||
axios.put<void>(`${BUSINESS_SERVICES}/${obj.id}`, obj); |
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.
I like the void callout here. Not sure why we were pretending to get something useful back before.
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.
I'll be revisiting all of the rest functions soon in a similar way.
Tested and LGTM! |
The
owner
field on theBusinessService
payload needs to be a pureRef
object or it will be rejected by the REST API call. Adopt the same set of data transforms used in the application-form to handle getting the correct set of data.Related changes:
Business services related REST API functions updated to have the correct response types
Business services queries updated to pass REST API response and input values to
onSuccess()
andonError()
handlersBusinessServiceForm
updated to use mutation response data to display the name of the business service in success messagesRefactored
business-service-form.tsx
to move all data access/mutation code to hook `useApplicationFormData() to logically divide concerns (data access v. UI handling)Resolves: https://issues.redhat.com/browse/MTA-1346