Skip to content

Commit

Permalink
test : 백엔드 api 테스트 코드
Browse files Browse the repository at this point in the history
  • Loading branch information
sangminlee98 committed Jan 4, 2023
1 parent 19ee37b commit f1f5a37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import { useQuery } from "@tanstack/react-query";
import React from "react";

export default function Main() {
const { data } = useQuery<Test>([QueryKeys.TEST], () =>
const { data: test } = useQuery<Test>([QueryKeys.TEST], () =>
restFetcher({ method: "GET", path: "test" }),
);
const { data: product } = useQuery(["PRODUCT"], () =>
restFetcher({ method: "GET", path: "/product" }),
);
return (
<div className="min-h-screen flex justify-center items-center">
<h1 className="text-3xl font-bold text-blue-600">{data}</h1>
<h1 className="text-3xl font-bold text-blue-600">{test}</h1>
<h1 className="text-3xl font-bold text-blue-600">
{JSON.stringify(product)}
</h1>
</div>
);
}
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default defineConfig({
server: {
port: 3000,
host: true,
proxy: {
"/api": "http://localhost:8001",
},
},
resolve: {
alias: {
Expand Down

0 comments on commit f1f5a37

Please sign in to comment.