diff --git a/.env.development b/.env.development index 8ba2b75..e8ffc9a 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,5 @@ API_VERSION=1 -API_URL=http://localhost:3002/api -GATEWAY_URL=http://localhost:3002 +GATEWAY_URL=http://localhost:4000 AUTH_URL=http://localhost:3003 CDN_URL=http://localhost:3004 MEDIA_PROXY_URL=http://localhost:3005 \ No newline at end of file diff --git a/src/app/channels/[channelId]/page.tsx b/src/app/channels/[channelId]/page.tsx index c0621ea..cfaffd1 100644 --- a/src/app/channels/[channelId]/page.tsx +++ b/src/app/channels/[channelId]/page.tsx @@ -7,9 +7,9 @@ import { useDispatch } from 'react-redux'; export default function SelectedChannelPage({ params -}: { +}: Readonly<{ params: { channelId: string }; -}) { +}>) { const { channelId } = params; const dispatch = useDispatch(); diff --git a/src/client/links.ts b/src/client/links.ts index 6e52c23..31d7ebf 100644 --- a/src/client/links.ts +++ b/src/client/links.ts @@ -1,6 +1,6 @@ export class ClientLinks { - api = process.env['API_URL'] as string; - cdn = process.env['CDN_URL'] as string; + api = process.env['API_URL']; + cdn = process.env['CDN_URL']; gateway = process.env['GATEWAY_URL'] ?? ('https://chat-backend.tnfangel.com' as string); - proxy = process.env['MEDIA_PROXY_URL'] as string; + proxy = process.env['MEDIA_PROXY_URL']; } diff --git a/src/components/channel/InputArea.tsx b/src/components/channel/InputArea.tsx index 6948204..ac56265 100644 --- a/src/components/channel/InputArea.tsx +++ b/src/components/channel/InputArea.tsx @@ -131,36 +131,37 @@ export default function InputArea({ channel }: InputBoxProps) { client.sentMessagesIds.push(tempMessageId); - await ky - .post(`${client.links.api}/channels/${channel?.id}/messages`, { - json: { content: content, nonce: tempMessageId } - }) - .json<{ id: string }>() - .then((result) => { - dispatch( - modifyMessage({ - channelId: rawMessage.channelId, - messageId: rawMessage.id, - newMessage: normalizeMessage({ - ...rawMessage, - mode: MessageModes.Sent, - id: result.id + if (client.links.api) + await ky + .post(`${client.links.api}/channels/${channel?.id}/messages`, { + json: { content: content, nonce: tempMessageId } + }) + .json<{ id: string }>() + .then((result) => { + dispatch( + modifyMessage({ + channelId: rawMessage.channelId, + messageId: rawMessage.id, + newMessage: normalizeMessage({ + ...rawMessage, + mode: MessageModes.Sent, + id: result.id + }) }) - }) - ); - }) - .catch(() => { - dispatch( - modifyMessage({ - channelId: rawMessage.channelId, - messageId: rawMessage.id, - newMessage: normalizeMessage({ - ...rawMessage, - mode: MessageModes.Blocked + ); + }) + .catch(() => { + dispatch( + modifyMessage({ + channelId: rawMessage.channelId, + messageId: rawMessage.id, + newMessage: normalizeMessage({ + ...rawMessage, + mode: MessageModes.Blocked + }) }) - }) - ); - }); + ); + }); } } diff --git a/src/components/screens/GuildScreen.tsx b/src/components/screens/GuildScreen.tsx index d8b250e..9c7616c 100644 --- a/src/components/screens/GuildScreen.tsx +++ b/src/components/screens/GuildScreen.tsx @@ -1,7 +1,7 @@ 'use client'; import useThemeColors from '@/hooks/useThemeColors'; import type { RootState } from '@/store'; -import { Center, Text, Flex, Heading, Stack } from '@chakra-ui/react'; +import { Center, Flex, Heading, Stack, Text } from '@chakra-ui/react'; import { useRouter } from 'next/navigation'; import { useRef } from 'react'; import GuildSidebar from '../layout/GuildSidebar'; @@ -49,7 +49,9 @@ export default function GuildScreen() { >