diff --git a/.env b/.env index 39e397d..f49f5c5 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_BASE_URL=http://13.238.194.87:3001 \ No newline at end of file +VITE_BASE_URL=https://backbell.site:3001 \ No newline at end of file diff --git a/src/pages/main/message-input/index.tsx b/src/pages/main/message-input/index.tsx index 960ba17..922cfc1 100644 --- a/src/pages/main/message-input/index.tsx +++ b/src/pages/main/message-input/index.tsx @@ -2,6 +2,7 @@ import { Box, Textarea, IconButton } from "@chakra-ui/react"; import { ArrowUpIcon } from "@chakra-ui/icons"; import styled from "@emotion/styled"; import { useRef, useEffect, useState } from "react"; +import axios from "axios"; interface MessageInputProps { inputMessage: string; @@ -39,14 +40,17 @@ export const MessageInput: React.FC = ({ }; useEffect(() => { - // baseURL을 사용하여 백엔드에서 데이터 가져오기 - fetch(`${baseURL}/api/test`) - .then((res) => res.json()) - .then((data) => { - setResponse(data); - console.log("Fetched data:", data); // 받은 데이터 콘솔에 출력 - }) - .catch((error) => console.error("Error fetching data:", error)); + const fetchData = async () => { + try { + const res = await axios.get(`${baseURL}/api/test`); + setResponse(res.data); + console.log("Fetched data:", res.data); + } catch (error) { + console.error("Error fetching data:", error); + } + }; + + fetchData(); }, [baseURL]); useEffect(() => {