-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into main
- Loading branch information
Showing
11 changed files
with
107 additions
and
47 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
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
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
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
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
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
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,43 +1,50 @@ | ||
/* eslint-disable */ | ||
|
||
import { useEffect } from 'react'; | ||
|
||
import { | ||
pipelinePagesActions, | ||
runsActions, | ||
pipelinesActions, | ||
runPagesActions, | ||
} from '../../../../redux/actions'; | ||
|
||
import { useDispatch } from '../../../hooks'; | ||
|
||
interface ServiceInterface { | ||
setFetching: (arg: boolean) => void; | ||
setFetchingForPipeline: (arg: boolean) => void; | ||
setFetchingForAllRuns: (arg: boolean) => void; | ||
} | ||
|
||
export const useService = (): ServiceInterface => { | ||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
setFetching(true); | ||
|
||
setFetchingForPipeline(true); | ||
setFetchingForAllRuns(true); | ||
dispatch( | ||
runsActions.allRuns({ | ||
onSuccess: () => setFetching(false), | ||
onFailure: () => setFetching(false), | ||
onSuccess: () => setFetchingForAllRuns(false), | ||
onFailure: () => setFetchingForAllRuns(false), | ||
}), | ||
); | ||
dispatch( | ||
pipelinesActions.getMy({ | ||
onSuccess: () => setFetching(false), | ||
onFailure: () => setFetching(false), | ||
onSuccess: () => setFetchingForPipeline(false), | ||
onFailure: () => setFetchingForPipeline(false), | ||
}), | ||
); | ||
}, []); | ||
|
||
const setFetching = (fetching: boolean) => { | ||
const setFetchingForPipeline = (fetching: boolean) => { | ||
dispatch(pipelinePagesActions.setFetching({ fetching })); | ||
}; | ||
const setFetchingForAllRuns = (fetching: boolean) => { | ||
dispatch(runPagesActions.setFetching({ fetching })); | ||
}; | ||
|
||
return { | ||
setFetching, | ||
setFetchingForPipeline, | ||
setFetchingForAllRuns, | ||
}; | ||
}; |
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
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
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
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