fix: frontend custom server 삭제, 회원가입 수정

This commit is contained in:
shinmj
2021-12-29 14:00:24 +09:00
parent 5582834ab7
commit 9123b92e92
10 changed files with 97 additions and 90 deletions

View File

@@ -20,4 +20,6 @@ export const SITE_ID = process.env.SITE_ID
export const GOOGLE_CLIENT_ID = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID
export const KAKAO_JAVASCRIPT_KEY = process.env.NEXT_PUBLIC_KAKAO_JAVASCRIPT_KEY
export const NAVER_CLIENT_ID = process.env.NEXT_PUBLIC_NAVER_CLIENT_ID
export const NAVER_CALLBACK_URL = process.env.NEXT_PUBLIC_NAVER_CALLBACK_URL
export const NAVER_CALLBACK_URL = process.env.NEXT_PUBLIC_NAVER_CALLBACK_URL
export const SOCIAL_LOGIN_ENABLED = process.env.SOCIAL_LOGIN_ENABLED

View File

@@ -4,11 +4,11 @@ import { makeStyles, Theme } from '@material-ui/core/styles'
import Alert from '@material-ui/lab/Alert'
import { ISocialUser, userService } from '@service'
import { format, isValidPassword } from '@utils'
import { GetServerSideProps } from 'next'
import { useRouter } from 'next/router'
import React, { createRef, useEffect, useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { GetServerSideProps } from 'next'
const useStyles = makeStyles((theme: Theme) => ({
alert: {
@@ -81,7 +81,6 @@ const Form = (props: FormProps) => {
useEffect(() => {
if (socialUser) {
if (socialUser.name) {
}
}
}, [socialUser])
@@ -175,7 +174,9 @@ const Form = (props: FormProps) => {
<input
ref={emailRef}
type="text"
readOnly={/*typeof socialUser.email !== 'undefined' && socialUser.email !== null*/false}
readOnly={
/*typeof socialUser.email !== 'undefined' && socialUser.email !== null*/ false
}
value={field.value}
onChange={field.onChange}
placeholder={t('user.email')}
@@ -284,7 +285,9 @@ const Form = (props: FormProps) => {
>
<input
type="text"
readOnly={/*typeof socialUser.name !== 'undefined' && socialUser.name !== null*/false}
readOnly={
/*typeof socialUser.name !== 'undefined' && socialUser.name !== null*/ false
}
value={field.value}
onChange={field.onChange}
placeholder={t('label.title.name')}
@@ -355,7 +358,7 @@ export const getServerSideProps: GetServerSideProps = async context => {
return {
props: {
socialUser
socialUser,
},
}
}

View File

@@ -5,7 +5,14 @@ import {
KakaoLoginButton,
NaverLoginButton,
} from '@components/Buttons'
import CustomConfirm, { CustomConfirmPrpps } from '@components/CustomConfirm'
import Loader from '@components/Loader'
import {
GOOGLE_CLIENT_ID,
KAKAO_JAVASCRIPT_KEY,
NAVER_CLIENT_ID,
SOCIAL_LOGIN_ENABLED,
} from '@constants/env'
import useUser from '@hooks/useUser'
import { ILogin, loginSerivce } from '@service'
import { userAtom } from '@stores'
@@ -13,7 +20,6 @@ import Router, { useRouter } from 'next/router'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useRecoilValue } from 'recoil'
import CustomConfirm, { CustomConfirmPrpps } from '@components/CustomConfirm'
interface AlertProps extends CustomConfirmPrpps {
message: string
@@ -62,7 +68,9 @@ const Login = () => {
})
// recoil 쓰려했는데 회원가입에 스탭이 있어서 진행중에 새로고침하면 상태가 삭제되면서 일반회원으로 가입될 수 있어서 소셜 정보를 파라미터로 넘김
router.push(`/auth/join?provider=${data.provider}&token=${data.token}`)
router.push(
`/auth/join?provider=${data.provider}&token=${data.token}`,
)
},
handleCancel: () => {
if (data.provider === 'kakao') {
@@ -131,16 +139,29 @@ const Login = () => {
{t('login.password_find')}
</ActiveLink>
</div>
<article>
<h3>
<span>{t('label.title.login.oauth')}</span>
</h3>
<div>
<KakaoLoginButton handleClick={handleKakaoLogin} kakaoLoginMode={kakaoLoginMode} setKakaoLoginMode={setKakaoLoginMode} />
<NaverLoginButton handleClick={handleNaverLogin} />
<GoogleLoginButton handleClick={handleGoogleLogin} />
</div>
</article>
{/** 소셜 로그인을 사용하는 경우 enabled 됨. */}
{SOCIAL_LOGIN_ENABLED === 'true' && (
<article>
<h3>
<span>{t('label.title.login.oauth')}</span>
</h3>
<div>
{KAKAO_JAVASCRIPT_KEY && (
<KakaoLoginButton
handleClick={handleKakaoLogin}
kakaoLoginMode={kakaoLoginMode}
setKakaoLoginMode={setKakaoLoginMode}
/>
)}
{NAVER_CLIENT_ID && (
<NaverLoginButton handleClick={handleNaverLogin} />
)}
{GOOGLE_CLIENT_ID && (
<GoogleLoginButton handleClick={handleGoogleLogin} />
)}
</div>
</article>
)}
{customConfirm && (
<CustomConfirm
handleConfirm={customConfirm.handleConfirm}