Skip to content

Commit 9b0da29

Browse files
fix(pos-app): remove /v1 prefix from merchants endpoint and clean up queryOptions
Base URL already includes /v1, so endpoint was resolving to /v1/v1/merchants/payments. Also remove unused queryOptions from useTransactions since sort/limit are hardcoded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5e44aee commit 9b0da29

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

dapps/pos-app/api/transactions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
5454

5555
const queryString = params.toString();
5656
const normalizedBaseUrl = apiBaseUrl.replace(/\/+$/, "");
57-
const endpoint = `/v1/merchants/payments${queryString ? `?${queryString}` : ""}`;
57+
const endpoint = `/merchants/payments${queryString ? `?${queryString}` : ""}`;
5858

5959
const response = await fetch(`${normalizedBaseUrl}${endpoint}`, {
6060
method: "GET",

dapps/pos-app/services/hooks.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
1414
import { useEffect, useMemo, useRef } from "react";
1515
import { cancelPayment, getPaymentStatus, startPayment } from "./payment";
16-
import { getTransactions, GetTransactionsOptions } from "./transactions";
16+
import { getTransactions } from "./transactions";
1717

1818
const KNOWN_STATUSES: string[] = [
1919
"requires_action",
@@ -172,7 +172,6 @@ interface UseTransactionsOptions {
172172
/**
173173
* Additional query options for the API
174174
*/
175-
queryOptions?: GetTransactionsOptions;
176175
}
177176

178177
/**
@@ -208,26 +207,21 @@ export function useTransactions(options: UseTransactionsOptions = {}) {
208207
enabled = true,
209208
filter = "all",
210209
dateRangeFilter = "today",
211-
queryOptions = {},
212210
} = options;
213211

214212
const addLog = useLogsStore.getState().addLog;
215213

216-
// Extract relevant fields for query key to avoid cache misses from object reference changes
217-
const { sortBy, sortDir, limit } = queryOptions;
218-
219214
// Compute date range once per filter change so toDate stays stable across paginated fetches
220215
const { startTs, endTs } = useMemo(
221216
() => getDateRange(dateRangeFilter),
222217
[dateRangeFilter],
223218
);
224219

225220
const query = useInfiniteQuery<TransactionsResponse, Error>({
226-
queryKey: ["transactions", filter, dateRangeFilter, sortBy, sortDir, limit],
221+
queryKey: ["transactions", filter, dateRangeFilter],
227222
queryFn: ({ pageParam }) => {
228223
const statusFilter = filterToStatusArray(filter);
229224
return getTransactions({
230-
...queryOptions,
231225
status: statusFilter,
232226
startTs,
233227
endTs,

dapps/pos-app/services/transactions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function getTransactions(
5757
}
5858

5959
const queryString = params.toString();
60-
const endpoint = `/v1/merchants/payments${queryString ? `?${queryString}` : ""}`;
60+
const endpoint = `/merchants/payments${queryString ? `?${queryString}` : ""}`;
6161

6262
return apiClient.get<TransactionsResponse>(endpoint, {
6363
headers,

0 commit comments

Comments
 (0)