-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
link back-end source config to frontend
- Loading branch information
1 parent
682272b
commit e9f6bf1
Showing
13 changed files
with
310 additions
and
96 deletions.
There are no files selected for viewing
30 changes: 15 additions & 15 deletions
30
hat/assets/js/apps/Iaso/domains/dataSources/components/ExportToDHIS2Dialog.js
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
28 changes: 28 additions & 0 deletions
28
hat/assets/js/apps/Iaso/domains/dataSources/hooks/useGetDataSourceVersion.ts
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,28 @@ | ||
/* eslint-disable camelcase */ | ||
import { UseQueryResult } from 'react-query'; | ||
import { getRequest } from '../../../libs/Api'; | ||
import { useSnackQuery } from '../../../libs/apiHooks'; | ||
import { Version } from '../types/dataSources'; | ||
|
||
const getDataSourceVersion = async ( | ||
version: string | undefined, | ||
): Promise<Version> => { | ||
return getRequest(`/api/sourceversions/${version}/`); | ||
}; | ||
|
||
export const useGetDataSourceVersion = ( | ||
versionId: string | undefined, | ||
): UseQueryResult<Version, Error> => { | ||
const queryKey: any[] = ['sourceVersions', versionId]; | ||
return useSnackQuery({ | ||
queryKey, | ||
queryFn: () => getDataSourceVersion(versionId), | ||
snackErrorMsg: undefined, | ||
options: { | ||
staleTime: 60000, | ||
cacheTime: 1000 * 60 * 5, | ||
keepPreviousData: true, | ||
enabled: !!versionId, | ||
}, | ||
}); | ||
}; |
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
Oops, something went wrong.