@@ -3,13 +3,15 @@ import { ProfileUserActions, UserActions } from 'app/actions';
33import * as ProfileUserFetch from 'app/apiFetch/ProfileUser' ;
44import { avatarName } from 'app/types/Authentication/Register' ;
55import { resType } from 'app/types/sagas' ;
6- import { call , put } from 'redux-saga/effects' ;
6+ import { all , call , put , takeEvery } from 'redux-saga/effects' ;
77import { ActionType } from 'typesafe-actions' ;
88
99export function * getMatchStats ( action : ActionType < typeof ProfileUserActions . getMatchStats > ) {
1010 try {
1111 const res = yield call ( ProfileUserFetch . getMatchStats , action . payload . username ) ;
1212 yield put ( UserActions . updateErrorMessage ( res . error ) ) ;
13+ console . log ( 'saga match res' ) ;
14+ console . log ( res ) ;
1315 if ( res . type !== resType . ERROR ) {
1416 const { avatarId, college, country, fullName, userType, username } = res . body ;
1517 yield put (
@@ -27,3 +29,20 @@ export function* getMatchStats(action: ActionType<typeof ProfileUserActions.getM
2729 console . error ( err ) ;
2830 }
2931}
32+
33+ export function * getUserProfile ( action : ActionType < typeof ProfileUserActions . getUserDetails > ) {
34+ try {
35+ const res = yield call ( ProfileUserFetch . getUserProfile , action . payload . username ) ;
36+ console . log ( 'saga profile res' ) ;
37+ console . log ( res ) ;
38+ } catch ( err ) {
39+ console . error ( err ) ;
40+ }
41+ }
42+
43+ export function * profileSagas ( ) {
44+ yield all ( [
45+ takeEvery ( ProfileUserActions . Type . GET_MATCH_STATS , getMatchStats ) ,
46+ takeEvery ( ProfileUserActions . Type . GET_PROFILE_USER_DETAILS , getUserProfile ) ,
47+ ] ) ;
48+ }
0 commit comments