TIL
-
<TIL> axios 사용 중에 있었던 일- Trello(6)TIL 2020. 3. 23. 21:13
서버와 통신을 할 때에는 유저 인증 해주는 token을 넣는 Authorization (headers 안에 위치해있다.)가 있습니다. 웹으로 할 때에는 cookie에 token을 넣어주고 요청을 할 때 headers에 withCredentials 옵션을 true로 설정하면 cookie안에 들어있는 token의 값이 자동으로 Authorization안에 넣어서 서버에 요청을 보냈습니다. 모바일에서는 서버와 통신을 할 때에는 token같은 값을 AsyncStorage에 넣습니다. 그 token은 요청을 할때마다 headers에 Authorization을 추가해서 token값을 넣어줘야 하는데 이번에 요청할 때 마다 그 값을 읽지 못하는 에러가 발생하였습니다. 그래서 서버에서 확인해보니 클라이언트 받은 헤더안..
-
<TIL> React-Native 로그인 플로우, 중첩 router - Trello(5)TIL 2020. 3. 20. 21:46
1. 로그인 플로우 App.js에서 AsyncSotrage에 저장된 토큰이 있는지 확인 로그인 화면 거치지 않고 로그인, 회원가입 할 수 있는 바로 메인 화면으로 이동 페이지로 이동 맨 상위 페이지 App.js import React, { Component } from 'react'; import 'react-native-gesture-handler'; import { AsyncStorage } from 'react-native'; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { createDrawerNavig..
-
<TIL> 로그인, 회원가입 화면 구현 - Trello(4)TIL 2020. 3. 19. 23:37
오늘은 로그인 , 회원가입 페이지를 구현하다가 새로 알게 된 것들에 대해 작성을 하겠습니다. 1. 에뮬레이터에서는 컴퓨터 로컬에서 돌리는 서버와 연결하려면 (127.0.0.1) IP주소말고 (10.0.2.2)로 변경해야 합니다. 처음에는 http://localhost:port로 연결을 시도 했지만 NetWork Error만 발생하고 서버에는 들어가지도 않는 상황이 발생하였습니다. 이러한 경우에는 IP 주소를 10.0.2.2 로 변경하여 http://10.0.2.2:port로 연결하면 작동이 됩니다. 관려 stackover flow : https://stackoverflow.com/questions/5528850/how-do-you-connect-localhost-in-the-android-emulator..
-
<TIL> module 설정 - Trello(2)TIL 2020. 3. 14. 20:52
6버전 이전에는 install을 하면 " react native link" 명령어를 사용하여 연결해야 했지만 6버전 이후부터는 link를 안해줘도 자동으로 link가 된다! 1. 사용 해야 할 router moudle npm install react-native-gesture-handler npm install react-native-safe-area-context npm install @react-native-community/masked-view npm install @react-navigation/drawer npm install @react-navigation/bottom-tabs npm install @react-navigation/native npm install @react-navigatio..