-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 카카오/네이버 로그인 시, 회원가입 필수 정보인 '주소'값을 받아올 수 없는 문제 발생 - 따라서 주소값을 입력받는 페이지 제작 ref: #67
- Loading branch information
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,5 +46,6 @@ | |
}, | ||
"devDependencies": { | ||
"eslint-config-enact-proxy": "^1.0.5" | ||
} | ||
}, | ||
"homepage": "./" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
packages/apps/user/src/views/Auth/AuthCallback/AuthCallback.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { | ||
Button, | ||
ButtonGroup, | ||
FormControl, | ||
FormErrorMessage, | ||
FormLabel, | ||
Heading, | ||
Input, | ||
Modal, | ||
ModalContent, | ||
ModalOverlay, | ||
VStack, | ||
useDisclosure, | ||
} from '@chakra-ui/react'; | ||
import { useForm } from 'react-hook-form'; | ||
import { Form } from 'react-router-dom'; | ||
import { DaumPostcodeEmbed } from 'react-daum-postcode'; | ||
import { useState } from 'react'; | ||
|
||
const AuthCallback = function () { | ||
const [address, setAddress] = useState(''); | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
const { | ||
register, | ||
handleSubmit, | ||
formState: { errors }, | ||
} = useForm(); | ||
|
||
const handleComplete = data => { | ||
setAddress(data.address); | ||
onClose(); | ||
}; | ||
|
||
const onSubmit = data => { | ||
//TODO 데이터의 address와 addressDetail을 서버로 전송 | ||
}; | ||
|
||
return ( | ||
<VStack height={'100vh'} justifyContent={'center'}> | ||
<Heading as={'h1'} mb={'8'}> | ||
필수 정보를 입력해주세요 | ||
</Heading> | ||
<Form onSubmit={handleSubmit(onSubmit)}> | ||
<FormControl width="full" isRequired isInvalid={errors.address}> | ||
<FormLabel margin={0}>주소</FormLabel> | ||
|
||
<Input | ||
required | ||
placeholder="주소" | ||
mb={'2'} | ||
{...register('address', { | ||
required: '이 항목은 필수입니다.', | ||
})} | ||
value={address} | ||
onClick={onOpen} | ||
readOnly | ||
/> | ||
<Input | ||
required | ||
placeholder="상세 주소" | ||
{...register('addressDetail', { | ||
required: '이 항목은 필수입니다.', | ||
})} | ||
/> | ||
|
||
<FormErrorMessage>{errors?.message}</FormErrorMessage> | ||
</FormControl> | ||
|
||
<ButtonGroup mt={'6'} display={'flex'} justifyContent={'flex-end'}> | ||
<Button type="submit" colorScheme="primary"> | ||
제출하기 | ||
</Button> | ||
</ButtonGroup> | ||
|
||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<DaumPostcodeEmbed onComplete={handleComplete} /> | ||
</ModalContent> | ||
</Modal> | ||
</Form> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default AuthCallback; |