From bfadfd4fdb18a6f0a1f3ad84dae4edf237962812 Mon Sep 17 00:00:00 2001 From: Ayush Kumar Sinha Date: Sun, 21 Jul 2019 02:25:51 +0530 Subject: [PATCH] indentation fix --- app.js | 310 ++++++++++---------- client/src/components/Branches.js | 146 ++++----- client/src/redux/actions/index.js | 68 ++--- client/src/redux/api/index.js | 84 +++--- client/src/redux/constants/index.js | 34 +-- client/src/redux/reducers/builderReducer.js | 8 +- client/src/redux/reducers/index.js | 20 +- client/src/redux/reducers/loadingReducer.js | 56 ++-- client/src/redux/sagas/buildersSaga.js | 15 +- client/src/redux/sagas/index.js | 14 +- 10 files changed, 377 insertions(+), 378 deletions(-) diff --git a/app.js b/app.js index 457c53a..1e6e0bf 100644 --- a/app.js +++ b/app.js @@ -12,230 +12,230 @@ const key = process.env.SECRET; //settings for production Environment if (!dev) { - app.disable('x-powered-by'); - // Serve static files from the React app - app.use(express.static(path.join(__dirname, 'client/build'))); + app.disable('x-powered-by'); + // Serve static files from the React app + app.use(express.static(path.join(__dirname, 'client/build'))); } //------- COMMITS END-POINT ------- function commitReq(sha, page) { - const commits = { - uri: 'https://api.github.com/repos/reactos/reactos/commits', - resolveWithFullResponse: true, - qs: { - access_token: key, - sha: sha, - per_page: 10, - page: page - }, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const commits = { + uri: 'https://api.github.com/repos/reactos/reactos/commits', + resolveWithFullResponse: true, + qs: { + access_token: key, + sha: sha, + per_page: 10, + page: page + }, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return commits; + return commits; } app.get('/api/commits', (req, res) => { - rp(commitReq(req.query.sha, req.query.page)) - .then(body => { - let link = body.headers.link; - let parsed = parse(link); - let dataAndPage = { - page: { - ...parsed - }, - commits: body - }; + rp(commitReq(req.query.sha, req.query.page)) + .then(body => { + let link = body.headers.link; + let parsed = parse(link); + let dataAndPage = { + page: { + ...parsed + }, + commits: body + }; - res.json(dataAndPage); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong', err: err }); - }); + res.json(dataAndPage); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong', err: err }); + }); }); //------- BRANCHES END-POINT ------- function branchReq() { - const branches = { - uri: 'https://api.github.com/repos/reactos/reactos/branches', - resolveWithFullResponse: false, - qs: { - access_token: key, - per_page: 100 - }, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const branches = { + uri: 'https://api.github.com/repos/reactos/reactos/branches', + resolveWithFullResponse: false, + qs: { + access_token: key, + per_page: 100 + }, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return branches; + return branches; } app.get('/api/branches', (req, res) => { - rp(branchReq()) - .then(body => { - res.json(body); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + rp(branchReq()) + .then(body => { + res.json(body); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); //------- PR'S END-POINT ------- function pullReq(state, page) { - const pulls = { - uri: 'https://api.github.com/repos/reactos/reactos/pulls', - resolveWithFullResponse: true, - qs: { - access_token: key, - state: state, - per_page: 10, - page: page - }, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const pulls = { + uri: 'https://api.github.com/repos/reactos/reactos/pulls', + resolveWithFullResponse: true, + qs: { + access_token: key, + state: state, + per_page: 10, + page: page + }, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return pulls; + return pulls; } app.get('/api/pulls', (req, res) => { - rp(pullReq(req.query.state, req.query.page)) - .then(body => { - let link = body.headers.link; - let parsed = parse(link); - let dataAndPage = { - page: { - ...parsed - }, - pulls: body - }; + rp(pullReq(req.query.state, req.query.page)) + .then(body => { + let link = body.headers.link; + let parsed = parse(link); + let dataAndPage = { + page: { + ...parsed + }, + pulls: body + }; - res.json(dataAndPage); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + res.json(dataAndPage); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); //------- BUILD-SET END-POINT ------- function buildSetReq() { - const buildSets = { - uri: - 'https://build.reactos.org/api/v2/buildsets?field=bsid&field=sourcestamps&order=-bsid&offset=0&limit=200', - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const buildSets = { + uri: + 'https://build.reactos.org/api/v2/buildsets?field=bsid&field=sourcestamps&order=-bsid&offset=0&limit=200', + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return buildSets; + return buildSets; } app.get('/api/buildsets', (req, res) => { - rp(buildSetReq()) - .then(body => { - res.json(body); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + rp(buildSetReq()) + .then(body => { + res.json(body); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); //------- BUILD-REQUEST END-POINT ------- function buildReq(str) { - const buildReq = { - uri: `https://build.reactos.org/api/v2/buildrequests?${str}&field=buildsetid&field=buildrequestid&order=-buildsetid`, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const buildReq = { + uri: `https://build.reactos.org/api/v2/buildrequests?${str}&field=buildsetid&field=buildrequestid&order=-buildsetid`, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return buildReq; + return buildReq; } app.get('/api/buildreq', (req, res) => { - let f = req.query.buildsetid__contains; - let queryStr = f.join('&buildsetid__contains='); - queryStr = 'buildsetid__contains=' + queryStr; - rp(buildReq(queryStr)) - .then(body => { - res.json(body); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + let f = req.query.buildsetid__contains; + let queryStr = f.join('&buildsetid__contains='); + queryStr = 'buildsetid__contains=' + queryStr; + rp(buildReq(queryStr)) + .then(body => { + res.json(body); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); //------- BUILDS END-POINT ------- function builds(str) { - const builds = { - uri: `https://build.reactos.org/api/v2/builds?${str}&order=-buildrequestid`, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const builds = { + uri: `https://build.reactos.org/api/v2/builds?${str}&order=-buildrequestid`, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return builds; + return builds; } app.get('/api/builds', (req, res) => { - let f = req.query.buildrequestid__contains; - let queryStr = f.join('&buildrequestid__contains='); - queryStr = 'buildrequestid__contains=' + queryStr; - rp(builds(queryStr)) - .then(body => { - res.json(body); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + let f = req.query.buildrequestid__contains; + let queryStr = f.join('&buildrequestid__contains='); + queryStr = 'buildrequestid__contains=' + queryStr; + rp(builds(queryStr)) + .then(body => { + res.json(body); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); //------- BRANCHES END-POINT ------- function builderReq() { - const builders = { - uri: 'https://build.reactos.org/api/v2/builders', - resolveWithFullResponse: false, - headers: { - 'User-Agent': 'Request-Promise' - }, - json: true - }; + const builders = { + uri: 'https://build.reactos.org/api/v2/builders', + resolveWithFullResponse: false, + headers: { + 'User-Agent': 'Request-Promise' + }, + json: true + }; - return builders; + return builders; } app.get('/api/builders', (req, res) => { - rp(builderReq()) - .then(body => { - res.json(body); - }) - .catch(function(err) { - res.json({ error: 'oops...something went wrong' }); - }); + rp(builderReq()) + .then(body => { + res.json(body); + }) + .catch(function(err) { + res.json({ error: 'oops...something went wrong' }); + }); }); if (!dev) { - app.get('*', (req, res) => { - res.sendFile(path.join(__dirname + '/client/build/index.html')); - }); + app.get('*', (req, res) => { + res.sendFile(path.join(__dirname + '/client/build/index.html')); + }); } app.listen(PORT, () => { - console.log('server started'); + console.log('server started'); }); diff --git a/client/src/components/Branches.js b/client/src/components/Branches.js index 84d4800..92adb2f 100644 --- a/client/src/components/Branches.js +++ b/client/src/components/Branches.js @@ -1,94 +1,94 @@ import React from 'react'; import { connect } from 'react-redux'; import { - Dropdown, - DropdownToggle, - DropdownMenu, - DropdownItem + Dropdown, + DropdownToggle, + DropdownMenu, + DropdownItem } from 'reactstrap'; import { - loadBranches, - loadCommits, - currBranch, - loadBuilders + loadBranches, + loadCommits, + currBranch, + loadBuilders } from '../redux/actions'; class Branches extends React.Component { - constructor(props) { - super(props); - this.state = { - dropdownOpen: false - }; - } - componentDidMount() { - this.props.loadBuilders(); - this.props.loadBranches(); - } + constructor(props) { + super(props); + this.state = { + dropdownOpen: false + }; + } + componentDidMount() { + this.props.loadBuilders(); + this.props.loadBranches(); + } - renderBranches = branch => { - return ( - { - this.props.currBranch(branch.name); - this.props.loadCommits(1); - }} - key={branch.name} - > - {branch.name} - - ); - }; - toggle = () => { - this.setState(prevState => ({ - dropdownOpen: !prevState.dropdownOpen - })); - }; - Stylemodif = data => { - return { - ...data, - styles: { - ...data.styles, - overflow: 'auto', - maxHeight: 500 - } + renderBranches = branch => { + return ( + { + this.props.currBranch(branch.name); + this.props.loadCommits(1); + }} + key={branch.name} + > + {branch.name} + + ); }; - }; - - render() { - return ( - - - - Branches - - { + this.setState(prevState => ({ + dropdownOpen: !prevState.dropdownOpen + })); + }; + Stylemodif = data => { + return { + ...data, + styles: { + ...data.styles, + overflow: 'auto', + maxHeight: 500 } - }} - > - {this.props.branches.map(this.renderBranches)} - - - ); - } + }; + }; + + render() { + return ( + + + + Branches + + + {this.props.branches.map(this.renderBranches)} + + + ); + } } const mapStateToProps = ({ branches }) => ({ - branches + branches }); const mapDispatchToProps = dispatch => ({ - loadCommits: next => dispatch(loadCommits(next)), - loadBranches: () => dispatch(loadBranches()), - loadBuilders: () => dispatch(loadBuilders()), - currBranch: branch => dispatch(currBranch(branch)) + loadCommits: next => dispatch(loadCommits(next)), + loadBranches: () => dispatch(loadBranches()), + loadBuilders: () => dispatch(loadBuilders()), + currBranch: branch => dispatch(currBranch(branch)) }); export default connect( - mapStateToProps, - mapDispatchToProps + mapStateToProps, + mapDispatchToProps )(Branches); diff --git a/client/src/redux/actions/index.js b/client/src/redux/actions/index.js index f0827ce..2a30890 100644 --- a/client/src/redux/actions/index.js +++ b/client/src/redux/actions/index.js @@ -1,85 +1,85 @@ import { COMMITS, BRANCHES, PULLS, BUILD_DATA, BUILDERS } from '../constants'; export const loadCommits = newPage => ({ - type: COMMITS.LOAD, - newPage + type: COMMITS.LOAD, + newPage }); export const setCommits = commits => ({ - type: COMMITS.LOAD_SUCCESS, - commits + type: COMMITS.LOAD_SUCCESS, + commits }); export const setCommitsError = error => ({ - type: COMMITS.LOAD_FAIL, - error + type: COMMITS.LOAD_FAIL, + error }); export const loadBuildSets = () => ({ - type: BUILD_DATA.LOAD + type: BUILD_DATA.LOAD }); export const setBuilds = build => ({ - type: BUILD_DATA.LOAD_SUCCESS, - build + type: BUILD_DATA.LOAD_SUCCESS, + build }); export const setBuildSetsError = error => ({ - type: BUILD_DATA.LOAD_FAIL, - error + type: BUILD_DATA.LOAD_FAIL, + error }); export const setPages = (next, prev) => ({ - type: 'PAGE_LOAD_SUCCESS', - next, - prev + type: 'PAGE_LOAD_SUCCESS', + next, + prev }); export const loadBranches = () => ({ - type: BRANCHES.LOAD + type: BRANCHES.LOAD }); export const setBranches = branches => ({ - type: BRANCHES.LOAD_SUCCESS, - branches + type: BRANCHES.LOAD_SUCCESS, + branches }); export const currBranch = branch => ({ - type: BRANCHES.CURRENT, - branch + type: BRANCHES.CURRENT, + branch }); export const setBranchesError = error => ({ - type: BRANCHES.LOAD_FAIL, - error + type: BRANCHES.LOAD_FAIL, + error }); export const loadBuilders = () => ({ - type: BUILDERS.LOAD + type: BUILDERS.LOAD }); export const setBuilders = builders => ({ - type: BUILDERS.LOAD_SUCCESS, - builders + type: BUILDERS.LOAD_SUCCESS, + builders }); export const setBuildersError = error => ({ - type: BUILDERS.LOAD_FAIL, - error + type: BUILDERS.LOAD_FAIL, + error }); export const currState = pullState => ({ - type: PULLS.CURRENT, - pullState + type: PULLS.CURRENT, + pullState }); export const loadPulls = newPage => ({ - type: PULLS.LOAD, - newPage + type: PULLS.LOAD, + newPage }); export const setPulls = pulls => ({ - type: PULLS.LOAD_SUCCESS, - pulls + type: PULLS.LOAD_SUCCESS, + pulls }); export const setPullsError = error => ({ - type: PULLS.LOAD_FAIL, - error + type: PULLS.LOAD_FAIL, + error }); diff --git a/client/src/redux/api/index.js b/client/src/redux/api/index.js index 7c1ae7f..37b6498 100644 --- a/client/src/redux/api/index.js +++ b/client/src/redux/api/index.js @@ -1,61 +1,61 @@ export const fetchCommits = async (sha, page) => { - const response = await fetch(`/api/commits?sha=${sha}&page=${page}`); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data; + const response = await fetch(`/api/commits?sha=${sha}&page=${page}`); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data; }; export const fetchBuildSets = async () => { - const response = await fetch('/api/buildsets'); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data.buildsets; + const response = await fetch('/api/buildsets'); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data.buildsets; }; export const fetchBuildReq = async str => { - const response = await fetch(`/api/buildreq?${str}`); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data.buildrequests; + const response = await fetch(`/api/buildreq?${str}`); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data.buildrequests; }; export const fetchBuilds = async str => { - const response = await fetch(`/api/builds?${str}`); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data.builds; + const response = await fetch(`/api/builds?${str}`); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data.builds; }; export const fetchBuilders = async () => { - const response = await fetch('/api/builders'); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data.builders; + const response = await fetch('/api/builders'); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data.builders; }; export const fetchBranches = async () => { - const response = await fetch('/api/branches'); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data; + const response = await fetch('/api/branches'); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data; }; export const fetchPulls = async (state, page) => { - const response = await fetch(`/api/pulls?state=${state}&page=${page}`); - const data = await response.json(); - if (response.status >= 400) { - throw new Error(data.errors); - } - return data; + const response = await fetch(`/api/pulls?state=${state}&page=${page}`); + const data = await response.json(); + if (response.status >= 400) { + throw new Error(data.errors); + } + return data; }; diff --git a/client/src/redux/constants/index.js b/client/src/redux/constants/index.js index a59e883..ee9db80 100644 --- a/client/src/redux/constants/index.js +++ b/client/src/redux/constants/index.js @@ -1,31 +1,31 @@ export const COMMITS = { - LOAD: 'COMMITS_LOAD', - LOAD_SUCCESS: 'COMMITS_LOAD_SUCCESS', - LOAD_FAIL: 'COMMITS_LOAD_FAIL' + LOAD: 'COMMITS_LOAD', + LOAD_SUCCESS: 'COMMITS_LOAD_SUCCESS', + LOAD_FAIL: 'COMMITS_LOAD_FAIL' }; export const BRANCHES = { - LOAD: 'BRANCHES_LOAD', - LOAD_SUCCESS: 'BRANCHES_LOAD_SUCCESS', - LOAD_FAIL: 'BRANCHES_LOAD_FAIL', - CURRENT: 'CURRENT_BRANCH' + LOAD: 'BRANCHES_LOAD', + LOAD_SUCCESS: 'BRANCHES_LOAD_SUCCESS', + LOAD_FAIL: 'BRANCHES_LOAD_FAIL', + CURRENT: 'CURRENT_BRANCH' }; export const PULLS = { - LOAD: 'PULLS_LOAD', - LOAD_SUCCESS: 'PULLS_LOAD_SUCCESS', - LOAD_FAIL: 'PULLS_LOAD_FAIL', - CURRENT: 'CURRENT_STATE' + LOAD: 'PULLS_LOAD', + LOAD_SUCCESS: 'PULLS_LOAD_SUCCESS', + LOAD_FAIL: 'PULLS_LOAD_FAIL', + CURRENT: 'CURRENT_STATE' }; export const BUILD_DATA = { - LOAD: 'BUILD_DATA_LOAD', - LOAD_SUCCESS: 'BUILD_DATA_LOAD_SUCCESS', - LOAD_FAIL: 'BUILD_DATA_LOAD_FAIL' + LOAD: 'BUILD_DATA_LOAD', + LOAD_SUCCESS: 'BUILD_DATA_LOAD_SUCCESS', + LOAD_FAIL: 'BUILD_DATA_LOAD_FAIL' }; export const BUILDERS = { - LOAD: 'BUILDER_LOAD', - LOAD_SUCCESS: 'BUILDER_LOAD_SUCCESS', - LOAD_FAIL: 'BUILDER_LOAD_FAIL' + LOAD: 'BUILDER_LOAD', + LOAD_SUCCESS: 'BUILDER_LOAD_SUCCESS', + LOAD_FAIL: 'BUILDER_LOAD_FAIL' }; diff --git a/client/src/redux/reducers/builderReducer.js b/client/src/redux/reducers/builderReducer.js index 49f35b8..223645c 100644 --- a/client/src/redux/reducers/builderReducer.js +++ b/client/src/redux/reducers/builderReducer.js @@ -1,10 +1,10 @@ import { BUILDERS } from '../constants'; const builderReducer = (state = [], action) => { - if (action.type === BUILDERS.LOAD_SUCCESS) { - return [...action.builders]; - } - return state; + if (action.type === BUILDERS.LOAD_SUCCESS) { + return [...action.builders]; + } + return state; }; export default builderReducer; diff --git a/client/src/redux/reducers/index.js b/client/src/redux/reducers/index.js index 4bfbf88..cef9eea 100644 --- a/client/src/redux/reducers/index.js +++ b/client/src/redux/reducers/index.js @@ -12,16 +12,16 @@ import pullStateReducer from './pullStateReducer'; import buildStatusReducer from './buildStatusReducer'; const rootReducer = combineReducers({ - isLoading: loadingReducer, - commits: commitsReducer, - error: errorReducer, - branches: branchReducer, - builders: builderReducer, - branch: selectedBranchReducer, - pulls: pullsReducer, - pullState: pullStateReducer, - page: pageReducer, - build: buildStatusReducer + isLoading: loadingReducer, + commits: commitsReducer, + error: errorReducer, + branches: branchReducer, + builders: builderReducer, + branch: selectedBranchReducer, + pulls: pullsReducer, + pullState: pullStateReducer, + page: pageReducer, + build: buildStatusReducer }); export default rootReducer; diff --git a/client/src/redux/reducers/loadingReducer.js b/client/src/redux/reducers/loadingReducer.js index 69e1e2e..d46b3cb 100644 --- a/client/src/redux/reducers/loadingReducer.js +++ b/client/src/redux/reducers/loadingReducer.js @@ -1,46 +1,46 @@ import { COMMITS, BRANCHES, PULLS, BUILD_DATA, BUILDERS } from '../constants'; const loadingReducer = (state = { newPage: 1, load: false }, action) => { - switch (action.type) { - case COMMITS.LOAD: - return { newPage: action.newPage, load: true }; + switch (action.type) { + case COMMITS.LOAD: + return { newPage: action.newPage, load: true }; - case BUILDERS.LOAD: - return { ...state, load: true }; + case BUILDERS.LOAD: + return { ...state, load: true }; - case PULLS.LOAD: - return { newPage: action.newPage, load: true }; + case PULLS.LOAD: + return { newPage: action.newPage, load: true }; - case BRANCHES.LOAD: - return { newPage: action.newPage, load: true }; + case BRANCHES.LOAD: + return { newPage: action.newPage, load: true }; - case BUILD_DATA.LOAD: - return { newPage: action.newPage, load: true }; + case BUILD_DATA.LOAD: + return { newPage: action.newPage, load: true }; - case COMMITS.LOAD_SUCCESS: - return { ...state, load: false }; + case COMMITS.LOAD_SUCCESS: + return { ...state, load: false }; - case BUILDERS.LOAD_SUCCESS: - return { ...state, load: true }; + case BUILDERS.LOAD_SUCCESS: + return { ...state, load: true }; - case PULLS.LOAD_SUCCESS: - return { ...state, load: false }; + case PULLS.LOAD_SUCCESS: + return { ...state, load: false }; - case BRANCHES.LOAD_SUCCESS: - return { newPage: action.newPage, load: true }; + case BRANCHES.LOAD_SUCCESS: + return { newPage: action.newPage, load: true }; - case BUILD_DATA.LOAD_SUCCESS: - return { load: false }; + case BUILD_DATA.LOAD_SUCCESS: + return { load: false }; - case COMMITS.LOAD_FAIL: - return { ...state, load: false }; + case COMMITS.LOAD_FAIL: + return { ...state, load: false }; - case PULLS.LOAD_FAIL: - return { ...state, load: false }; + case PULLS.LOAD_FAIL: + return { ...state, load: false }; - default: - return { ...state, load: false }; - } + default: + return { ...state, load: false }; + } }; export default loadingReducer; diff --git a/client/src/redux/sagas/buildersSaga.js b/client/src/redux/sagas/buildersSaga.js index 58c4be6..17b612e 100644 --- a/client/src/redux/sagas/buildersSaga.js +++ b/client/src/redux/sagas/buildersSaga.js @@ -4,15 +4,14 @@ import { fetchBuilders } from '../api'; import { setBuilders, setBuildersError } from '../actions'; function* handleBuildersLoad() { - try { - const builders = yield call(fetchBuilders); - console.log(builders); - yield put(setBuilders(builders)); - } catch (error) { - yield put(setBuildersError(error.toString())); - } + try { + const builders = yield call(fetchBuilders); + yield put(setBuilders(builders)); + } catch (error) { + yield put(setBuildersError(error.toString())); + } } export default function* watchBuildersLoad() { - yield takeEvery(BUILDERS.LOAD, handleBuildersLoad); + yield takeEvery(BUILDERS.LOAD, handleBuildersLoad); } diff --git a/client/src/redux/sagas/index.js b/client/src/redux/sagas/index.js index 5fa4cfa..76f0df6 100644 --- a/client/src/redux/sagas/index.js +++ b/client/src/redux/sagas/index.js @@ -7,11 +7,11 @@ import buildersSaga from './buildersSaga'; import buildSetSaga from './buildSetSaga'; export default function* rootSaga() { - yield all([ - commitsSaga(), - branchesSaga(), - pullsSaga(), - buildersSaga(), - buildSetSaga() - ]); + yield all([ + commitsSaga(), + branchesSaga(), + pullsSaga(), + buildersSaga(), + buildSetSaga() + ]); }