Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WhenMeet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
websystem2023-2
WhenMeet
Commits
4b81d427
Commit
4b81d427
authored
1 year ago
by
Min Dong Hyeun
Browse files
Options
Downloads
Patches
Plain Diff
[EDIT] HomeParticipateForm
parent
c79dd678
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
react-whenMeet/src/components/HomeParticipateForm.js
+71
-75
71 additions, 75 deletions
react-whenMeet/src/components/HomeParticipateForm.js
react-whenMeet/src/components/MeetingInfoForm.js
+11
-5
11 additions, 5 deletions
react-whenMeet/src/components/MeetingInfoForm.js
with
82 additions
and
80 deletions
react-whenMeet/src/components/HomeParticipateForm.js
+
71
−
75
View file @
4b81d427
...
@@ -31,14 +31,15 @@ function HomeParticipateForm() {
...
@@ -31,14 +31,15 @@ function HomeParticipateForm() {
}
}
}
}
const
newH
andleSubmit
=
async
(
event
)
=>
{
const
h
andleSubmit
=
async
(
event
)
=>
{
event
.
preventDefault
();
event
.
preventDefault
();
if
(
name
===
""
)
{
if
(
name
===
""
)
{
alert
(
'
이름을 입력하세요
'
)
alert
(
'
이름을 입력하세요
'
)
}
}
else
{
else
{
let
checkParticipant
=
await
checkParticipantExistence
();
let
checkParticipant
=
await
checkParticipantExistence
();
if
(
checkParticipant
){
console
.
log
(
checkParticipant
);
if
(
checkParticipant
)
{
// DB에 해당 이름이 존재하지 않으면
try
{
try
{
const
response
=
await
axios
.
post
(
`http://localhost:3000/meetings/
${
id
}
/participants`
,
{
const
response
=
await
axios
.
post
(
`http://localhost:3000/meetings/
${
id
}
/participants`
,
{
name
:
name
,
name
:
name
,
...
@@ -94,19 +95,15 @@ function HomeParticipateForm() {
...
@@ -94,19 +95,15 @@ function HomeParticipateForm() {
console
.
error
(
error
);
console
.
error
(
error
);
}
}
}
}
else
{
else
{
// 이미 DB에 참여자가 존재하는 경우
alert
(
'
이미 존재하는 이름입니다.
'
);
}
}
};
const
oldHandleSubmit
=
async
(
event
)
=>
{
event
.
preventDefault
();
if
(
name
===
""
)
{
alert
(
'
이름을 입력하세요
'
)
}
else
{
try
{
try
{
const
response
=
await
axios
.
post
(
`http://localhost:3000/meetings/
${
id
}
/entry`
,{
const
response
=
await
axios
.
get
(
`http://localhost:3000/meetings/
${
id
}
/my/schedules`
);
//투표 여부 확인을 위해
if
(
response
.
data
.
schedules
.
length
)
{
// 투표를 진행하였으면 결과 페이지로 이동
navigate
(
'
ResultEnd
'
);
}
else
{
// 투표를 안했으면 투표페이지로 이동
try
{
// 쿠키 재생성
await
axios
.
post
(
`http://localhost:3000/meetings/
${
id
}
/entry`
,
{
name
:
name
,
name
:
name
,
password
:
password
password
:
password
},
{
},
{
...
@@ -147,7 +144,12 @@ function HomeParticipateForm() {
...
@@ -147,7 +144,12 @@ function HomeParticipateForm() {
}
else
{
}
else
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
}
}
}
catch
(
error
)
{
console
.
err
(
error
);
}
}
}
}
}
};
};
...
@@ -156,7 +158,6 @@ function HomeParticipateForm() {
...
@@ -156,7 +158,6 @@ function HomeParticipateForm() {
<
form
>
<
form
>
<
div
>
<
div
>
<
h1
>
투표에
참여하기
<
/h1
>
<
h1
>
투표에
참여하기
<
/h1
>
{
console
.
log
({
id
})}
<
Input
<
Input
type
=
"
text
"
type
=
"
text
"
value
=
{
name
}
value
=
{
name
}
...
@@ -177,13 +178,8 @@ function HomeParticipateForm() {
...
@@ -177,13 +178,8 @@ function HomeParticipateForm() {
/>
/>
<
Button
<
Button
type
=
'
submit
'
type
=
'
submit
'
text
=
'
신규참여
'
text
=
'
참여
'
onClick
=
{
newHandleSubmit
}
onClick
=
{
handleSubmit
}
/
>
<
Button
type
=
'
submit
'
text
=
'
재참여
'
onClick
=
{
oldHandleSubmit
}
/
>
/
>
<
/div
>
<
/div
>
<
/form
>
<
/form
>
...
...
This diff is collapsed.
Click to expand it.
react-whenMeet/src/components/MeetingInfoForm.js
+
11
−
5
View file @
4b81d427
...
@@ -23,7 +23,13 @@ function MeetingInfoForm() {
...
@@ -23,7 +23,13 @@ function MeetingInfoForm() {
}
}
const
handleNumber
=
(
event
)
=>
{
const
handleNumber
=
(
event
)
=>
{
setNumber
(
event
.
target
.
value
);
const
inputValue
=
event
.
target
.
value
;
if
(
inputValue
>=
0
){
setNumber
(
inputValue
);
}
else
{
alert
(
"
양수만을 입력하세요
"
);
}
}
}
const
handleVoteEnd
=
(
event
)
=>
{
const
handleVoteEnd
=
(
event
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment