-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e13ec3f
commit 808a87e
Showing
12 changed files
with
527 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
import { NextResponse } from "next/server"; | ||
import { TransactionType } from "~~/types/transaction"; | ||
|
||
let nextId = 0; | ||
let transactions: TransactionType[] = []; | ||
|
||
export async function GET(request: Request) { | ||
return Response.json(transactions) | ||
export async function GET() { | ||
return NextResponse.json(transactions); | ||
} | ||
|
||
export async function POST(request: Request) { | ||
const body = await request.json(); | ||
const newTx = body as TransactionType; | ||
newTx.id = nextId; | ||
transactions.push(newTx) | ||
nextId++; | ||
return Response.json(newTx); | ||
const body = await request.json(); | ||
const newTx = body as TransactionType; | ||
newTx.id = nextId; | ||
transactions.push(newTx); | ||
nextId++; | ||
return NextResponse.json(newTx); | ||
} | ||
|
||
export async function PUT(request: Request) { | ||
const body = await request.json(); | ||
const updatedTransaction = body as TransactionType; | ||
transactions = transactions.map(tx => (tx.id === updatedTransaction.id ? { ...tx, ...updatedTransaction } : tx)); | ||
|
||
const body = await request.json(); | ||
const updatedTransaction = body as TransactionType; | ||
transactions = transactions.map(tx => | ||
tx.id === updatedTransaction.id ? { ...tx, ...updatedTransaction } : tx | ||
); | ||
|
||
return Response.json(updatedTransaction) | ||
return NextResponse.json(updatedTransaction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
export const Banner = () => { | ||
return ( | ||
<> | ||
<div className="text-center mt-8 bg-secondary p-6"> | ||
<h1 className="text-4xl my-0">Transactions</h1> | ||
<p className="text-neutral"> | ||
Select a type of transaction to create and wait for other signers to validate it. | ||
<br />Then it will be executed automatically | ||
</p> | ||
</div> | ||
</> | ||
) | ||
} | ||
return ( | ||
<> | ||
<div className="text-center mt-8 bg-secondary p-6"> | ||
<h1 className="text-4xl my-0">Transactions</h1> | ||
<p className="text-neutral"> | ||
Select a type of transaction to create and wait for other signers to validate it. | ||
<br /> | ||
Then it will be executed automatically | ||
</p> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default Banner; | ||
export default Banner; |
Oops, something went wrong.