Skip to content

Commit

Permalink
api: loans: Update request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed Jun 3, 2024
1 parent 611d57a commit 1381ed0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
5 changes: 4 additions & 1 deletion src/lib/api/loans/loan.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const doCheckout = async (
documentPid,
itemPid,
patronPid,
{ startDate = null, endDate = null, force = false } = {}
{ startDate = null, endDate = null, force = false, selfCheckout = false } = {}
) => {
const currentUser = sessionManager.user;
const payload = {
Expand All @@ -108,6 +108,9 @@ const doCheckout = async (
if (force) {
payload.force = true;
}
if (selfCheckout) {
payload.self_checkout = true;
}

const response = await http.post(apiPaths.checkout, payload);
response.data = serializer.fromJSON(response.data);
Expand Down
36 changes: 20 additions & 16 deletions src/lib/pages/frontsite/SelfCheckout/SelfCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,26 @@ class SelfCheckout extends React.Component {
</List.Item>
</List>
<Grid centered>
<Grid.Column>
<Image
src={
process.env.PUBLIC_URL +
'/images/correct-self-checkout-method.png'
}
/>
</Grid.Column>
<Grid.Column>
<Image
src={
process.env.PUBLIC_URL +
'/images/incorrect-self-checkout-method.png'
}
/>
</Grid.Column>
<Grid.Row>
<Grid.Column width={8}>
<Image
src={
process.env.PUBLIC_URL +
'/images/correct-self-checkout-method.png'
}
size="large"
/>
</Grid.Column>
<Grid.Column width={8}>
<Image
src={
process.env.PUBLIC_URL +
'/images/incorrect-self-checkout-method.png'
}
size="large"
/>
</Grid.Column>
</Grid.Row>
</Grid>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/pages/frontsite/SelfCheckout/state/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export const checkoutItem = (
documentPid,
itemPid,
patronPid,
force = false
selfCheckout = true
) => {
return async (dispatch) => {
try {
const response = await loanApi.doCheckout(
documentPid,
itemPid,
patronPid,
{ force: force }
{ selfCheckout: selfCheckout }
);
const { pid } = response.data.metadata;
const linkToLoan = (
Expand Down

0 comments on commit 1381ed0

Please sign in to comment.