Commit 4ab1ada5 authored by 健杭 徐's avatar 健杭 徐
Browse files

111

parent 2be90194
...@@ -16,7 +16,7 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () => ...@@ -16,7 +16,7 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
const response = await fetch(COMMENT_ADD, { const response = await fetch(COMMENT_ADD, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, content, created_at: new Date().toISOString() }) body: JSON.stringify({ name, content })
}); });
const result = await response.json(); const result = await response.json();
...@@ -28,7 +28,6 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () => ...@@ -28,7 +28,6 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
textInput.value = ''; textInput.value = '';
(document.getElementById('nameInput') as HTMLInputElement).value = ''; (document.getElementById('nameInput') as HTMLInputElement).value = '';
onSuccess(); onSuccess();
} catch (error) { } catch (error) {
console.error('添加评论失败:', error); console.error('添加评论失败:', error);
} }
......
export const COMMENT_ADD: string = 'http://localhost:8080/comment/add' const IP: string = 'http://10.197.150.54:8080'
export const COMMENT_GET: string = 'http://localhost:8080/comment/get'
export const COMMENT_DEL: string = 'http://localhost:8080/comment/delete' export const COMMENT_ADD: string = IP + '/comment/add'
\ No newline at end of file export const COMMENT_GET: string = IP + '/comment/get'
export const COMMENT_DEL: string = IP + '/comment/delete'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment