-
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
5bfc0e4
commit ab72b97
Showing
2 changed files
with
33 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
import axios from "axios"; | ||
|
||
async function Server() { | ||
// const queryClient = new QueryClient(); | ||
// await queryClient.prefetchQuery({ | ||
// queryKey: ["test"], | ||
// queryFn: () => { | ||
// return axios.get("http://localhost:3000/api/v1/test", { | ||
// headers: { | ||
// name: "Sayan De from Client Component", | ||
// }, | ||
// }); | ||
// }, | ||
// }); | ||
// const { data, error, isLoading } = useQuery({ | ||
// queryKey: ["test"], | ||
// queryFn: () => { | ||
// return axios.get("http://localhost:3000/api/v1/test", { | ||
// headers: { | ||
// name: "Sayan De from Client Component", | ||
// }, | ||
// }); | ||
const response = await fetch("http://localhost:3000/api/v1/test", { | ||
method: "GET", | ||
}).then((ans) => ans.json()); | ||
// .get("/api/v1/test", { | ||
// headers: { | ||
// name: "Sayan De from Server Component", | ||
// }, | ||
// }); | ||
// console.log("😊datadatadatadatadata",data); | ||
const response = await axios | ||
.get("http://localhost:3000/api/v1/test", { | ||
headers: { | ||
name: "Sayan De from Server Component", | ||
}, | ||
}) | ||
.then((ans) => ans.data); | ||
// }) | ||
// .then((ans) => ans.data); | ||
|
||
console.log("😊datadatadatadatadata", response); | ||
return <div>{response?.Hi}</div>; | ||
} | ||
|
||
export default Server; | ||
|
||
// const queryClient = new QueryClient(); | ||
// await queryClient.prefetchQuery({ | ||
// queryKey: ["test"], | ||
// queryFn: () => { | ||
// return axios.get("http://localhost:3000/api/v1/test", { | ||
// headers: { | ||
// name: "Sayan De from Client Component", | ||
// }, | ||
// }); | ||
// }, | ||
// }); | ||
// const { data, error, isLoading } = useQuery({ | ||
// queryKey: ["test"], | ||
// queryFn: () => { | ||
// return axios.get("http://localhost:3000/api/v1/test", { | ||
// headers: { | ||
// name: "Sayan De from Client Component", | ||
// }, | ||
// }); | ||
// }, | ||
// }); | ||
// console.log("😊datadatadatadatadata",data); |