Skip to content

Commit

Permalink
Merge pull request #167 from CoolPeace-yanolza/feature/#164
Browse files Browse the repository at this point in the history
[#164] 로그인 게스트 계정 기본 설정
  • Loading branch information
dabin-Hailey authored Feb 10, 2024
2 parents 4a74ea9 + 31018ad commit c9c8f4b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/api/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ const onErrorResponse = async (error: AxiosResponseError<string>) => {
}
}
console.log(error.response.data.code, error.response);
return Promise.reject(error);
}
console.log('response error : ', error);
return Promise.reject(error);
};

// 요청 인터셉터 추가
Expand Down
2 changes: 2 additions & 0 deletions src/components/Auth/AuthButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const SubmitButton = styled.button<AuthButtonStyleProps>`
return '#C1C1C1';
} else if (props.$variant === 'pink') {
return 'linear-gradient(91deg, #FF3478 1.39%, #FF83AD 98.63%)';
} else if (props.$variant === 'skyblue') {
return 'linear-gradient(89.18deg, #3182F6 0%, #6AB2FF 111.65%)';
} else {
return '#1A2849';
}
Expand Down
17 changes: 16 additions & 1 deletion src/components/Login/LoginForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ const LoginForm = ({ handleModalOpen }: LoginFormProps) => {
const navigate = useNavigate();
const { state } = useLocation();

const methods = useForm({ mode: 'onBlur' });
const methods = useForm({
mode: 'onBlur'
});
const {
setValue,
formState: { errors },
handleSubmit
} = methods;
const isError = !!errors?.login_id || !!errors?.login_password ? true : false;

const setDefaultValues = async () => {
setValue('login_id', '[email protected]');
setValue('login_password', 'test1234!');
};

const movetoSignUp = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
navigate('/signup');
Expand Down Expand Up @@ -110,6 +118,13 @@ const LoginForm = ({ handleModalOpen }: LoginFormProps) => {
text="회원가입"
buttonFunc={movetoSignUp}
/>
<AuthButton
buttonType="button"
size="large"
variant="skyblue"
text="게스트 계정으로 둘러보기"
buttonFunc={setDefaultValues}
/>
</Buttons>
</form>
</FormProvider>
Expand Down
1 change: 0 additions & 1 deletion src/utils/lib/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { SetCookies, GetCookies } from '@/types/auth';
export const setCookies: SetCookies = (name, value, expiresIn) => {
try {
document.cookie = `${name}=${value};max-age=${expiresIn};path=/;secure`;
console.log(`${name}: 쿠키설정 성공`);
} catch (error) {
console.log(error);
alert(`${name}: 쿠키설정에 실패했습니다.`);
Expand Down

0 comments on commit c9c8f4b

Please sign in to comment.