-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: turns out tanstack docs suck and break your code
- Loading branch information
Showing
5 changed files
with
53 additions
and
119 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TransactionData } from "@/lib/validators/search"; | ||
|
||
export default async function getTransaction({ endpoint, hash } : { endpoint: string, hash: string}) { | ||
console.log(`Fetching: POST ${endpoint}?q=${hash}`); | ||
const res = await fetch(`http://localhost:3000${endpoint}?q=${hash}`, { method: "GET" }); | ||
const json = await res.json(); | ||
console.log("Fetched Result:", json); | ||
const result = TransactionData.safeParse(json); | ||
if (result.success) { | ||
return result.data; | ||
} else { | ||
throw new Error(result.error.message); | ||
} | ||
} |
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