-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SETTING] scraper redux, redux-thunk 세팅 #33
Conversation
@kingyong9169 |
export function success_calender():ThunkAction<void,RootState,null, CalenderAction>{ | ||
return async dispatch =>{ | ||
try{ | ||
const response = await axios.get(`https://api.github.com/users/kingyong9169`) | ||
dispatch({type: SUCCESS_CALENDER, payload: response.data}); | ||
return Promise.resolve(response.data); | ||
} catch(err){ | ||
return Promise.reject(err); | ||
} | ||
} | ||
} | ||
|
||
export function fail_calender():ThunkAction<void,RootState,null,CalenderAction>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명은 camelCase
로 변경 부탁드려요~ 참고: CMI-OSS/common#2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger that!
@@ -0,0 +1,29 @@ | |||
import { CalenderAction } from './../interfaces/ActionInterfaces/CalenderInterface'; | |||
import { RootState } from './../reducers/index'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { RootState } from './../reducers/index'; | |
import { RootState } from './../reducers'; |
아마 이렇게 하셔도 될거에용(아마?)
기본적으로 index를 보고있어서
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋습니다~
전 아직 그대로에여ㅠㅠ |
아래 링크로 해결은 했지만 껄끄러운 부분이 있습니다.. |
@kingyong9169 |
|
@kingyong9169 |
앗 뭣모르고 그냥 썼군요.. 명심하겠슴당! |
👀 이슈
resolve #27
📌 개요
scraper에서 사용할 redux, redux-thunk를 이용한 api 호출 기본 세팅입니다.
👩💻 작업 사항
scraper에서 사용할 action, reducer, store 기본 세팅을 하였고 실행을 통해 순수 redux는 작동한다는 것을 알게 되었습니다.
하지만 redux-thunk를 사용할 때,
store.dispatch(success_calender())
처럼 dispatch안에함수(파라미터)
를 넣어 api호출하는 것을 예전에 프로젝트(javascript)하면서 했었는데 typescript로 하려니 type맞추는 부분에서 어려운 부분이 있어 pr에 도움요청합니다ㅠㅠ✅ 참고 사항