|
1 | 1 | /* eslint-disable */ |
2 | 2 |
|
| 3 | +import axios from 'axios'; |
3 | 4 | import { useEffect } from 'react'; |
| 5 | +import { source } from '../../../../api/fetchApi'; |
| 6 | +// import { cancel } from '../../../../api/fetchApi'; |
| 7 | + |
4 | 8 | import { |
5 | 9 | pipelinePagesActions, |
6 | 10 | runsActions, |
7 | 11 | pipelinesActions, |
| 12 | + runPagesActions, |
8 | 13 | } from '../../../../redux/actions'; |
9 | 14 |
|
10 | 15 | import { useDispatch } from '../../../hooks'; |
11 | 16 |
|
12 | 17 | interface ServiceInterface { |
13 | | - setFetching: (arg: boolean) => void; |
| 18 | + setFetchingForPipeline: (arg: boolean) => void; |
| 19 | + setFetchingForAllRuns: (arg: boolean) => void; |
14 | 20 | } |
15 | 21 |
|
16 | 22 | export const useService = (): ServiceInterface => { |
17 | 23 | const dispatch = useDispatch(); |
18 | 24 |
|
19 | 25 | useEffect(() => { |
20 | | - setFetching(true); |
21 | | - |
| 26 | + setFetchingForPipeline(true); |
| 27 | + setFetchingForAllRuns(true); |
22 | 28 | dispatch( |
23 | 29 | runsActions.allRuns({ |
24 | | - onSuccess: () => setFetching(false), |
25 | | - onFailure: () => setFetching(false), |
| 30 | + onSuccess: () => setFetchingForAllRuns(false), |
| 31 | + onFailure: () => setFetchingForAllRuns(false), |
26 | 32 | }), |
27 | 33 | ); |
28 | 34 | dispatch( |
29 | 35 | pipelinesActions.getMy({ |
30 | | - onSuccess: () => setFetching(false), |
31 | | - onFailure: () => setFetching(false), |
| 36 | + onSuccess: () => setFetchingForPipeline(false), |
| 37 | + onFailure: () => setFetchingForPipeline(false), |
32 | 38 | }), |
33 | 39 | ); |
34 | 40 | }, []); |
35 | 41 |
|
36 | | - const setFetching = (fetching: boolean) => { |
| 42 | + const setFetchingForPipeline = (fetching: boolean) => { |
37 | 43 | dispatch(pipelinePagesActions.setFetching({ fetching })); |
38 | 44 | }; |
| 45 | + const setFetchingForAllRuns = (fetching: boolean) => { |
| 46 | + dispatch(runPagesActions.setFetching({ fetching })); |
| 47 | + }; |
39 | 48 |
|
40 | 49 | return { |
41 | | - setFetching, |
| 50 | + setFetchingForPipeline, |
| 51 | + setFetchingForAllRuns, |
42 | 52 | }; |
43 | 53 | }; |
0 commit comments