Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/transactions/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export async function GET(
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}

// Fetch transaction (RLS will ensure user can only see their own)
const { data: transaction, error: txError } = await supabase
.from("transactions")
.select("*")
.eq("id", id)
.eq("user_id", user.id)
.single();

if (txError) {
Expand Down
2 changes: 2 additions & 0 deletions app/api/transactions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export async function POST(req: NextRequest) {
.from("transactions")
.select("*")
.eq("idempotency_key", idempotencyKey)
.eq("user_id", user.id)
.single();

if (existingTx) {
Expand Down Expand Up @@ -218,6 +219,7 @@ export async function GET(req: NextRequest) {
.from("transactions")
.select("*")
.eq("transaction_type", "USER")
.eq("user_id", user.id)
.order("created_at", { ascending: false });

if (txError) {
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/[txHash]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export default async function TransactionDetailsPage(
redirect("/auth/login");
}

// Fetch the real transaction by tx_hash
const { data: transaction, error: txError } = await supabase
.from("transactions")
.select("*")
.eq("tx_hash", txHash)
.eq("user_id", data.user.id)
.single();

if (txError || !transaction) {
Expand Down