Skip to content

Commit

Permalink
[CHORE] remove console.log and
Browse files Browse the repository at this point in the history
  • Loading branch information
catherineeangel committed May 27, 2024
1 parent bf227bf commit 1c57497
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/dashboard/TransactionHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const TransactionHistory = ({ status }: TransactionHistoryI) => {
'hover:underline hover:underline-offset-1'
)}
>
<p>{status?.toUpperCase()}</p>
<p>{(status ?? '').toUpperCase()}</p>
{!!midtrans_url && (
<i className="i-ph-arrow-square-up-right-light size-5" />
)}
Expand Down
16 changes: 11 additions & 5 deletions src/app/payment/PaymentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const PaymentDetail = () => {
getTransaction({ order_id: orderId })
}
}, [orderId])
const test_stat = null

useEffect(() => {
if (!!error && 'data' in error) {
// Adjusted regex to correctly extract JSON surrounded by backticks
const regex = /API response: `({.*})`/
const match = (error.data as MidtransErrorResponse).error.match(regex)
console.log(match)
if (match && match[1]) {
const jsonPart = match[1]
try {
Expand Down Expand Up @@ -77,11 +77,17 @@ export const PaymentDetail = () => {
<p className="font-bold">Package Name</p>
<p>{data?.transaction_detail.package.name}</p>
<p className="font-bold">Payment Type</p>
<p>{data?.transaction_detail.payment_type?.toUpperCase()}</p>
<p>
{(data?.transaction_detail.payment_type ?? '').toUpperCase()}
</p>
<p className="font-bold">Merchant</p>
<p>{data?.transaction_detail.payment_merchant?.toUpperCase()}</p>
<p>
{(
data?.transaction_detail.payment_merchant ?? ''
).toUpperCase()}
</p>
<p className="font-bold">Status</p>
<p>{data?.transaction_detail.status?.toUpperCase()}</p>
<p>{(data?.transaction_detail.status ?? '')?.toUpperCase()}</p>
</div>
<Button
onClick={() => {
Expand All @@ -95,7 +101,7 @@ export const PaymentDetail = () => {
</>
)
)}
<Link href={'/payment?tab=history'}>
<Link href={'/dashboard?tab=history'}>
<Button>See Transaction History</Button>
</Link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/payment/PaymentError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const PaymentError = ({ status }: PaymentDetailI) => {
<p>
Transaction status:{' '}
<span className="font-bold text-rose-700">
{status?.toUpperCase()}
{(status ?? '').toUpperCase()}
</span>
</p>
)}
Expand Down

0 comments on commit 1c57497

Please sign in to comment.