Skip to content

Commit 7b3abe6

Browse files
committed
fix: return feature post
1 parent 60d7009 commit 7b3abe6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/borrows/CardBorrow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import clsx from 'clsx'
2323
const checkIsDue = (borrow: Borrow) => {
2424
const now = new Date()
2525
const due = new Date(borrow.due_at)
26-
return now > due
26+
return now > due && !borrow.returning
2727
}
2828

2929
const getBorrowStatus = (borrow: Borrow) => {
@@ -39,7 +39,7 @@ export const CardBorrow: React.FC<{ borrow: Borrow }> = ({ borrow }) => {
3939
<Card
4040
key={borrow.id}
4141
className={clsx('relative', {
42-
'bg-destructive/5': isDue && !borrow.returning?.returned_at,
42+
'bg-destructive/5': isDue,
4343
})}
4444
>
4545
<CardHeader>

lib/api/borrow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const returnBorrow = async (
6868
): GetBorrowResponse => {
6969
const response = await fetch(`${BORROW_URL}/${data.id}/return`, {
7070
...init,
71-
method: 'PUT',
71+
method: 'POST',
7272
body: JSON.stringify(data),
7373
headers: {
7474
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)