forked from abalone0204/Clairvoyance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
119f514
commit e05d65c
Showing
2 changed files
with
71 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
takeEvery | ||
} from 'redux-saga' | ||
|
||
import { | ||
put, | ||
call | ||
} from 'redux-saga/effects' | ||
|
||
import { | ||
FETCH_INIT_JOB_OBJECT, | ||
setInitJobObject, | ||
failToInitJobObject, | ||
} from 'actions/initialize.js' | ||
|
||
import getProvider, { | ||
getProviderName, | ||
getJobQuery | ||
} from '../providers' | ||
|
||
|
||
|
||
export function* watchFetchInitJobObject() { | ||
yield call(takeEvery, FETCH_INIT_JOB_OBJECT, initJobObjectFlow) | ||
} | ||
|
||
export function* initJobObjectFlow(action) { | ||
try { | ||
const providerName = yield call(getProviderName) | ||
const provider = yield call(getProvider) | ||
const jobObject = yield call(getJobQuery, provider) | ||
yield put(setInitJobObject(jobObject)) | ||
|
||
} catch (error) { | ||
yield put(failToInitJobObject(error)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
import {watchRequestLogin} from './login.js' | ||
import {watchRequestLeaveComment} from './leaveComment.js' | ||
import {watchRequestFetchComments} from './fetchComments.js' | ||
import {watchRequestFetchJob} from './fetchJob.js' | ||
import {watchRequestCreateJob} from './createJob.js' | ||
import { | ||
transactionOfJobAndComments | ||
watchRequestLogin | ||
} from './login.js' | ||
import { | ||
watchRequestLeaveComment | ||
} from './leaveComment.js' | ||
import { | ||
watchRequestFetchComments | ||
} from './fetchComments.js' | ||
import { | ||
watchRequestFetchJob | ||
} from './fetchJob.js' | ||
import { | ||
watchRequestCreateJob | ||
} from './createJob.js' | ||
import { | ||
transactionOfJobAndComments | ||
} from './transactionFlows.js' | ||
import { | ||
watchRequestFetchWorkingTimes, | ||
} from './fetchWorkingTimes.js' | ||
|
||
import { | ||
watchFetchInitJobObject, | ||
} from './fetchInitJobObject.js' | ||
|
||
export default function* rootSaga() { | ||
yield [ | ||
watchRequestLogin(), | ||
watchRequestLeaveComment(), | ||
watchRequestFetchComments(), | ||
watchRequestFetchJob(), | ||
watchRequestCreateJob(), | ||
transactionOfJobAndComments() | ||
] | ||
} | ||
yield [ | ||
watchRequestLogin(), | ||
watchRequestLeaveComment(), | ||
watchRequestFetchComments(), | ||
watchRequestFetchJob(), | ||
watchRequestCreateJob(), | ||
transactionOfJobAndComments(), | ||
watchRequestFetchWorkingTimes(), | ||
watchFetchInitJobObject(), | ||
] | ||
} |