Skip to content

Commit b8de01b

Browse files
committed
refactor(api): simplify API endpoint URLs in message.js
- Removed hardcoded localhost URLs for fetching posts and comments. - removed unused eslint-disabled directive import/namespace Resolves: no-ticket
1 parent 98bf3af commit b8de01b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/api/message.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
export const getPost = async (postId) => {
1313
try {
14-
// TODO: handle production and development environments
15-
const response = await fetch(`http://localhost:5173/api/post/${postId}`);
14+
const response = await fetch(`/api/post/${postId}`);
1615
return await response.json();
1716
} catch (error) {
1817
throw new Error('Failed to load post: ', error);
@@ -21,10 +20,7 @@ export const getPost = async (postId) => {
2120

2221
export const getComments = async (postId) => {
2322
try {
24-
// TODO: handle production and development environments
25-
const response = await fetch(
26-
`http://localhost:5173/api/comments?postId=${postId}`,
27-
);
23+
const response = await fetch(`/api/comments?postId=${postId}`);
2824
return await response.json();
2925
} catch (error) {
3026
throw new Error('Failed to load comments: ', error);

0 commit comments

Comments
 (0)