작성
·
1.1K
0
react-native-config - ios 하는 법도 알려주세요.
.env에 파일에서 API_URL=http://10.0.2.2:3105 설정하고 회원가입 페이지가서
react-native-config 라이브러리 import하면 config의 값의 undefined로 나옵니다.
안드로이드 말고 ios도 설정하는 법 알려주세요.
답변 1
0
try {
setLoading(true);
setLoading(true);
const response = await axios.post(`${Config.API_URL}/user`, {
email,
name,
password,
});
console.log(
'🚀 ~ file: index.tsx ~ line 103 ~ onSubmit ~ response',
response.data,
);
Alert.alert('알림', '회원가입 되었습니다.');
navigation.navigate('SignIn');
} catch (error) {
const errorResponse = (error as AxiosError<{message: string}>).response;
console.log(
'🚀 ~ file: index.tsx ~ line 111 ~ onSubmit ~ errorResponse',
errorResponse,
);
catch 부분에서
'🚀 ~ file: index.tsx ~ line 111 ~ onSubmit ~ errorResponse', { UNSENT: 0,
OPENED: 1,
HEADERS_RECEIVED: 2,
LOADING: 3,
DONE: 4,
readyState: 4,
status: 0,
timeout: 0,
withCredentials: true,
upload: {},
_aborted: false,
_hasError: true,
_method: 'POST',
_perfKey: 'network_XMLHttpRequest_undefined/user',
_response: 'The file “user” couldn’t be opened because there is no such file.',
_url: 'undefined/user',
_timedOut: false,
_trackingName: 'unknown',
_incrementalEvents: false,
_performanceLogger:
{ _timespans:
{ 'network_XMLHttpRequest_http://localhost:8081/symbolicate':
{ startTime: 178711051.372208,
startExtras: undefined,
endExtras: undefined,
endTime: 178711081.524916,
totalTime: 30.152707993984222 },
'network_XMLHttpRequest_undefined/user': { startTime: 178802455.364166, startExtras: undefined } },
_extras: {},
_points:
{ initializeCore_start: 178710871.696208,
<…>
이렇게 출력되고 있습니다. 참고로 pod install 했습니다.
수정했습니다