-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfetchData.tsx
More file actions
40 lines (32 loc) · 940 Bytes
/
fetchData.tsx
File metadata and controls
40 lines (32 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use client";
import { api } from "~/trpc/react";
export function TestButton() {
const utils = api.useUtils();
const { data } = api.leetcode.checkNewCompletions.useQuery({
week: 1,
userId: "cmc6w9tlp000025100bzz0zwb",
leetcodeUser: "pyoro",
});
const { data: data2 } = api.leetcode.getProblemById.useQuery({
problemId: 1024,
});
const { data: data3 } = api.leetcode.getProblemBySlug.useQuery({
slug: data2?.titleSlug ?? "",
});
// data 2 === data3
const { data: data4 } = api.leetcode.getQuestionDescription.useQuery({
titleSlug: data2?.titleSlug ?? "",
});
console.log("data:", data);
console.log("data2:", data2);
console.log("data3:", data3);
console.log("data4:", data4);
return (
<button
// onClick={() => utils.post.invalidate()}
className="text-primary-background rounded-lg bg-primary-foreground p-2 font-main"
>
API Tests
</button>
);
}