Skip to content

Commit

Permalink
sdp-tech#78 feat: set domain url
Browse files Browse the repository at this point in the history
  • Loading branch information
eujin-shin committed Jun 22, 2024
1 parent 138df0d commit 37bdb80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import SignIn from './src/components/Auth/SignIn';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { BottomBarProvider, useBottomBar } from './contexts/BottomBarContext';
import { LoginProvider } from './src/common/Context';
import Reformer from './src/components/Auth/Reformer/Reformer';

export type StackProps = {
Home: undefined;
Signin: undefined;
ReformProfile: undefined;
};

const Stack = createNativeStackNavigator<StackProps>();
Expand All @@ -49,6 +51,7 @@ function App(): React.JSX.Element {
})}>
<Stack.Screen name="Home" component={HomeTab} />
<Stack.Screen name="Signin" component={SignIn} />
<Stack.Screen name="ReformProfile" component={Reformer} />
</Stack.Navigator>
</NavigationContainer>
</LoginProvider>
Expand Down
10 changes: 7 additions & 3 deletions src/common/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export default function Request() {
const accessToken = await getAccessToken();
const refreshToken = await getRefreshToken();

const url = UPCY_API_URL + path;
// upcy temp api url: http://52.78.43.6:8000/
// upcy domain: http://upcy.co.kr:8000/
// https 요청 문제로 도메인 연결 보류

const url = 'http://52.78.43.6:8000/' + path;

let headerValue;

Expand All @@ -37,7 +41,7 @@ export default function Request() {
// 백엔드와 통신 자체가 실패(ERR_CONNECTION_REFUSED)
console.log(err);
Alert.alert('ERR_CONNECTION_REFUSED' + UPCY_API_URL);
console.warn(UPCY_API_URL);
console.warn(url);
throw err;
} else if (err.response.status === 401) {
// access 토큰이 만료된 경우 또는 로그인이 필요한 기능의 경우
Expand All @@ -47,7 +51,7 @@ export default function Request() {
// refresh 토큰을 통해 access 토큰 재발급
try {
const response = await axios.post(
UPCY_API_URL + '/users/token/refresh/',
UPCY_API_URL + 'users/token/refresh/',
{
refresh: refreshToken,
},
Expand Down
5 changes: 5 additions & 0 deletions src/pages/MyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ const MyPageMainScreen = ({ navigation, route }: MypageStackProps) => {
navigation.getParent()?.navigate('홈');
};

const goReformRegister = () => {
navigation.navigate('ReformProfile');
};

return (
<SafeAreaView>
<Text>마이페이지</Text>
<Text>{userInfo.nickname}님 안녕하세요.</Text>
<Button onPress={goReformRegister} title="프로필 등록" />
<Button onPress={handleLogout} title="로그아웃" />
</SafeAreaView>
);
Expand Down

0 comments on commit 37bdb80

Please sign in to comment.