File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,11 @@ const Button: React.FC<ButtonProps> = ({
41
41
const navigate = useNavigate ( ) ;
42
42
const handleClick = ( ) => {
43
43
if ( onClick ) {
44
- onClick ( ) ; // onClick이 존재하면 호출
45
- }
46
- if ( link ) {
47
- navigate ( link ) ;
44
+ onClick ( ) ;
45
+ } else {
46
+ if ( link ) {
47
+ navigate ( link ) ;
48
+ }
48
49
}
49
50
} ;
50
51
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import Button from "@components/common/button/Button";
3
3
import HintText from "@components/common/hintText/HintText1" ;
4
4
import TeamButton from "@components/create/TeamButton" ;
5
5
import { instance } from "@apis/instance" ;
6
+ import { useNavigate } from "react-router-dom" ;
6
7
7
8
const Container = styled . div `
8
9
height: calc(100vh - 80px);
@@ -19,12 +20,14 @@ const ButtonLayout = styled.div`
19
20
` ;
20
21
21
22
const Create : React . FC = ( ) => {
23
+ const navigate = useNavigate ( ) ;
22
24
const postData = async ( ) => {
23
25
try {
24
26
const response = await instance . post ( "/teams/" , {
25
27
member_count : localStorage . getItem ( "member_count" ) ,
26
28
} ) ;
27
29
localStorage . setItem ( "team_id" , response . data . team_id ) ;
30
+ navigate ( "/login" ) ;
28
31
} catch ( err ) {
29
32
console . log ( err ) ;
30
33
}
@@ -41,12 +44,7 @@ const Create: React.FC = () => {
41
44
</ Container >
42
45
43
46
< ButtonLayout >
44
- < Button
45
- onClick = { postData }
46
- type = "submit"
47
- link = "/login"
48
- name = "팀 동기화 시작하기"
49
- />
47
+ < Button onClick = { postData } type = "submit" name = "팀 동기화 시작하기" />
50
48
</ ButtonLayout >
51
49
</ >
52
50
) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import React from "react";
6
6
import styled from "styled-components" ;
7
7
import Button from "@components/common/button/Button" ;
8
8
import { instance } from "@apis/instance" ;
9
+ import { useNavigate } from "react-router-dom" ;
9
10
10
11
const Container = styled . div `
11
12
height: calc(100vh - 80px);
@@ -28,6 +29,7 @@ const ButtonLayout = styled.div`
28
29
` ;
29
30
30
31
const Login : React . FC = ( ) => {
32
+ const navigate = useNavigate ( ) ;
31
33
const handleNameChange = ( data : string ) => {
32
34
localStorage . setItem ( "name" , data ) ;
33
35
} ;
@@ -45,6 +47,7 @@ const Login: React.FC = () => {
45
47
}
46
48
) ;
47
49
localStorage . setItem ( "profile_id" , response . data . profile_id ) ;
50
+ navigate ( `/invite/${ teamID } /${ localStorage . getItem ( "member_count" ) } ` ) ;
48
51
} catch ( err ) {
49
52
console . log ( err ) ;
50
53
}
@@ -73,7 +76,7 @@ const Login: React.FC = () => {
73
76
< Button
74
77
onClick = { postData }
75
78
type = "submit"
76
- link = { `/invite/ ${ teamID } / ${ localStorage . getItem ( "member_count" ) } ` }
79
+ // link={}
77
80
name = "팀 참가하기"
78
81
/>
79
82
</ ButtonLayout >
You can’t perform that action at this time.
0 commit comments