diff --git a/backEnd/api/src/crawler/crawler.controller.ts b/backEnd/api/src/crawler/crawler.controller.ts index 8b65aa4..f987cde 100644 --- a/backEnd/api/src/crawler/crawler.controller.ts +++ b/backEnd/api/src/crawler/crawler.controller.ts @@ -1,23 +1,29 @@ import { Controller, Get, Query } from '@nestjs/common'; import { CrawlerService } from './crawler.service'; -@Controller('crawler') +@Controller() export class CrawlerController { constructor(private readonly crawlerService: CrawlerService) {} - @Get() + @Get('/crawler') async crawling(@Query('url') url: string) { const content = await this.crawlerService.findOne(url); return content; } - @Get('v1') + @Get('/nginx') + async nginxCaching(@Query('url') url: string) { + const content = await this.crawlerService.findOne(url); + return content; + } + + @Get('/crawler/v1') async crawlingV1(@Query('url') url: string) { const content = await this.crawlerService.findOne(url); return content; } - @Get('v2') + @Get('/crawler/v2') async crawlingV2(@Query('url') url: string) { const content = await this.crawlerService.findOneUsingCache(url); return content; diff --git a/frontEnd/src/components/room/QuizViewSection.tsx b/frontEnd/src/components/room/QuizViewSection.tsx index cdf55e5..566b3b5 100644 --- a/frontEnd/src/components/room/QuizViewSection.tsx +++ b/frontEnd/src/components/room/QuizViewSection.tsx @@ -11,11 +11,25 @@ import useInput from '@/hooks/useInput'; function QuizViewSection() { const inputRef = useRef(null); const [url, setURL] = useState(''); - const { data, isLoading } = useQuery({ queryKey: [QUERY_KEYS, url], queryFn: () => getQuizData(url), enabled: !!url }); - const { inputValue, onChange } = useInput(url); + const { data, isLoading, error } = useQuery({ queryKey: [QUERY_KEYS, url], queryFn: () => getQuizData(url), enabled: !!url }); + const { inputValue, onChange, resetInput } = useInput(url); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); + + const isURL = inputValue.match(/^(http(s)?:\/\/)[^\s@.][\w\s@.]+[.][^\s@.]+$/); + + if (!isURL && inputRef.current) { + inputRef.current.placeholder = '잘못된 URL입니다!'; + resetInput(); + setTimeout(() => { + if (inputRef.current) inputRef.current.placeholder = '링크를 입력하세요'; + }, 1000); + return; + } + + if (!inputValue) return; + setURL(inputValue); }; @@ -27,7 +41,7 @@ function QuizViewSection() { return (
-
+
- {data && url ? : } + {data && url ? : }
); diff --git a/frontEnd/src/components/room/chatting/ChattingInput.tsx b/frontEnd/src/components/room/chatting/ChattingInput.tsx index 5a2f7d9..9f0fb9b 100644 --- a/frontEnd/src/components/room/chatting/ChattingInput.tsx +++ b/frontEnd/src/components/room/chatting/ChattingInput.tsx @@ -28,7 +28,7 @@ export default function ChattingInput({ usingAi, setUsingAi, postingAi, setPosti const { roomId } = useParams(); const handleMessageSend = () => { - if (!socket) return; + if (!socket || !message) return; if (usingAi) { setPostingAi(true); @@ -52,7 +52,7 @@ export default function ChattingInput({ usingAi, setUsingAi, postingAi, setPosti }; return ( -
+