-
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
9af6ee7
commit 80a7347
Showing
3 changed files
with
40 additions
and
5 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
17 changes: 17 additions & 0 deletions
17
packages/libs/user-datasets/src/lib/Hooks/user-datasets.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,17 @@ | ||
import { useNonNullableContext } from '@veupathdb/wdk-client/lib/Hooks/NonNullableContext'; | ||
import { WdkDependenciesContext } from '@veupathdb/wdk-client/lib/Hooks/WdkDependenciesEffect'; | ||
import { useMemo } from 'react'; | ||
import { UserDatasetApi } from '../Service/api'; | ||
|
||
function useWdkServiceContext() { | ||
const { wdkService } = useNonNullableContext(WdkDependenciesContext); | ||
return wdkService; | ||
} | ||
|
||
export function useConfiguredVdiClient(baseUrl: string) { | ||
const wdkService = useWdkServiceContext(); | ||
return useMemo( | ||
() => new UserDatasetApi({ baseUrl }, wdkService), | ||
[baseUrl, wdkService] | ||
); | ||
} |
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