Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
健杭 徐
intern_project_frontend_backend
Commits
4ab1ada5
Commit
4ab1ada5
authored
Aug 27, 2025
by
健杭 徐
Browse files
111
parent
2be90194
Changes
2
Show whitespace changes
Inline
Side-by-side
comment-system/static/src/App.tsx
View file @
4ab1ada5
...
...
@@ -16,7 +16,7 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
const
response
=
await
fetch
(
COMMENT_ADD
,
{
method
:
'
POST
'
,
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
();
...
...
@@ -28,7 +28,6 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
textInput
.
value
=
''
;
(
document
.
getElementById
(
'
nameInput
'
)
as
HTMLInputElement
).
value
=
''
;
onSuccess
();
}
catch
(
error
)
{
console
.
error
(
'
添加评论失败:
'
,
error
);
}
...
...
comment-system/static/src/assets/const.tsx
View file @
4ab1ada5
export
const
COMMENT_ADD
:
string
=
'
http://localhost:8080/comment/add
'
export
const
COMMENT_GET
:
string
=
'
http://localhost:8080/comment/get
'
export
const
COMMENT_DEL
:
string
=
'
http://localhost:8080/comment/delete
'
\ No newline at end of file
const
IP
:
string
=
'
http://10.197.150.54:8080
'
export
const
COMMENT_ADD
:
string
=
IP
+
'
/comment/add
'
export
const
COMMENT_GET
:
string
=
IP
+
'
/comment/get
'
export
const
COMMENT_DEL
:
string
=
IP
+
'
/comment/delete
'
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment