Skip to content

Commit

Permalink
feat: 회원가입 - 위치 api 연동 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenS3same committed Dec 4, 2024
1 parent 0626807 commit bafdc26
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/api/loginApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export const postSignUp = async (body: {
return response.data;
};

export const postSignUpLocation = async (body: { address: string }) => {
const response = await axiosInstance.post(`/users/checkaddress`, body);

return response.data;
};

export const postSignIn = async (body: { email: string; password: string }) => {
const response = await axiosInstance.post(`/users/login`, body);

Expand Down
13 changes: 11 additions & 2 deletions src/components/pages/login/SetLocationPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';
import { postSignUpLocation } from '../../../api/loginApi';
import KakaoMap from '../../common/KakaoMap';

function SetLocationPage() {
Expand Down Expand Up @@ -83,8 +84,16 @@ function SetLocationPage() {
</KakaoMapWrapper>

<LoginButton
onClick={() => {
navigate('/setnickname');
onClick={async () => {
if (region) {
const response = await postSignUpLocation({ address: region });

if (response.message === '주소 확인 완료') {
navigate('/setnickname');
} else {
alert('주소를 다시 확인해주세요.');
}
}
}}
>
Next
Expand Down

0 comments on commit bafdc26

Please sign in to comment.