-
Notifications
You must be signed in to change notification settings - Fork 15
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
(refactor) Replace usages of /ws/rest/v1/
with restBaseUrl
#13
Conversation
@@ -46,7 +46,7 @@ const BillWaiverForm: React.FC<BillWaiverFormProps> = ({ bill, lineItems, setPat | |||
isLowContrast: true, | |||
}); | |||
setPatientUuid(''); | |||
mutate((key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/cashier/bill?v=full'), undefined, { | |||
mutate((key) => typeof key === 'string' && key.startsWith('${restBaseUrl}/cashier/bill?v=full'), undefined, { |
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.
mutate((key) => typeof key === 'string' && key.startsWith('${restBaseUrl}/cashier/bill?v=full'), undefined, { | |
mutate((key) => typeof key === 'string' && key.startsWith(`${restBaseUrl}/cashier/bill?v=full`), undefined, { |
@@ -33,7 +33,7 @@ export function useServiceTypes() { | |||
} | |||
|
|||
export const usePaymentModes = () => { | |||
const url = `/ws/rest/v1/cashier/paymentMode`; | |||
const url = `${restBaseUrl}cashier/paymentMode`; |
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.
const url = `${restBaseUrl}cashier/paymentMode`; | |
const url = `${restBaseUrl}/cashier/paymentMode`; |
e2e/core/global-setup.ts
Outdated
@@ -15,7 +16,7 @@ async function globalSetup() { | |||
const token = Buffer.from(`${process.env.E2E_USER_ADMIN_USERNAME}:${process.env.E2E_USER_ADMIN_PASSWORD}`).toString( | |||
'base64', | |||
); | |||
await requestContext.post(`${process.env.E2E_BASE_URL}/ws/rest/v1/session`, { | |||
await requestContext.post(`${process.env.E2E_BASE_URL}${restBaseUrl}/session`, { |
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.
Don't change the occurrences in the e2e
directory.
/ws/rest/v1/
with restBaseUrl
Thanks @jwnasambu for this, quick question, is the restBaseUrl respresenting |
@CynthiaKamau Thanks for the good question. In my understanding restBaseUrl is representing /ws/rest/v1/ since its an absolute path starting from the root of the domain and not ws/rest/v1/ which is a relative path that dependent on the current location. Kindly help me understand more dear. My tests I have been looking at the desired behavior and the structure of the web application or API. |
Thats fine @jwnasambu , kindly fix the conflicts then we can merge this in |
@@ -18,7 +18,7 @@ const PrintReceipt: React.FC<PrintReceiptProps> = ({ billId }) => { | |||
renderIcon={(props) => <Printer size={24} {...props} />}> | |||
<ConfigurableLink | |||
className={styles.configurableLink} | |||
to={`\${openmrsBase}/ws/rest/v1/cashier/receipt?billId=${billId}`}> | |||
to={`\${openmrsBase}/${restBaseUrl}/cashier/receipt?billId=${billId}`}> |
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.
to={\${openmrsBase}${restBaseUrl}/cashier/receipt?billId=${billId}
}>
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.
@CynthiaKamau Thanks for the review! Let me fix and ping you shortly.
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.
to={
\${openmrsBase}${restBaseUrl}/cashier/receipt?billId=${billId}
}>
@CynthiaKamau by removing the backticks, we will lose the ability to use template literals and expressions directly within the string. In this case:
- ${openmrsBase} and ${restBaseUrl} won't be evaluated as variables; they will be treated as literal strings.
- ${billId} won't be evaluated either; it will be treated as a literal string.
As a result, the final value of the to
attribute would be the concatenation of the literal strings, and the variable names won't be replaced with their actual values.
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.
@CynthiaKamau I have fixed the merge conflict and part of the proposed changes.
…ng-app into (refactor)O3-2815
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.
Thanks @jwnasambu for this
Requirements
For changes to apps
If applicable
Summary
Change all instances of the hard-coded API base URL '/ws/rest/v1/' to use the restBaseUrl variable instead. To enhances maintainability and flexibility of the API base URL configuration.
Screenshots
N/A
Related Issue
https://openmrs.atlassian.net/browse/O3-2815
Other