Skip to content

Commit

Permalink
chore : 테스트 API 추가 및 proxy 코드 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
sangminlee98 committed Jan 6, 2023
1 parent f1f5a37 commit 3c28bc1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
9 changes: 4 additions & 5 deletions src/pages/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { useQuery } from "@tanstack/react-query";
import React from "react";

export default function Main() {
const { data: test } = useQuery<Test>([QueryKeys.TEST], () =>
restFetcher({ method: "GET", path: "test" }),
);
const { data: product } = useQuery(["PRODUCT"], () =>
const { data: product } = useQuery<Test[]>([QueryKeys.TEST], () =>
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">{test}</h1>
<h1 className="text-3xl font-bold text-blue-600">
{JSON.stringify(product)}
</h1>
<h1 className="text-3xl font-bold text-blue-600">
{JSON.stringify(product)}
</h1>
Expand Down
2 changes: 1 addition & 1 deletion src/queryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const getClient = (() => {
})();

const { VITE_BASE_URL } = import.meta.env;
const BASE_URL = VITE_BASE_URL || "/";
const BASE_URL = VITE_BASE_URL || "http://localhost:8000/api";

export const restFetcher = async ({
method,
Expand Down
8 changes: 7 additions & 1 deletion src/types/test.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export type Test = string;
export type Test = {
id: number;
name: string;
point: string;
bloom: string;
toxin: string;
};
3 changes: 0 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ export default defineConfig({
server: {
port: 3000,
host: true,
proxy: {
"/api": "http://localhost:8001",
},
},
resolve: {
alias: {
Expand Down

0 comments on commit 3c28bc1

Please sign in to comment.