Skip to content

Commit 5a924be

Browse files
committed
refactor: generalize fetchData function to handle different types
1 parent 131ba26 commit 5a924be

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fetch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ export const fetchDatasets = async (variables: any) => {
66
return data;
77
};
88

9-
export const fetchUseCases = async (variables: any) => {
9+
10+
export const fetchData = async (type: string, variables: any) => {
1011
const response = await fetch(
11-
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/search/usecase/${variables}`
12+
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/search/${type}/${variables}`
1213
);
1314
const data = await response.json();
1415
return data;

0 commit comments

Comments
 (0)