Skip to content

Commit

Permalink
Merge pull request #18 from moh-kenya/feat-search
Browse files Browse the repository at this point in the history
Add search concept feature
  • Loading branch information
rosaga authored Feb 1, 2024
2 parents b36f1f6 + 0b99489 commit 20e4859
Show file tree
Hide file tree
Showing 5 changed files with 1,977 additions and 1,071 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@mui/x-data-grid": "^6.19.2",
"next": "14.1.0",
"react": "^18",
"react-dom": "^18"
"react-dom": "^18",
"swr": "^2.2.4"
}
}
21 changes: 21 additions & 0 deletions pages/api/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import useSWR from "swr";

export const searchConcepts = (searchParams) => {
const fetcher = (url) => fetch(url).then((res) => res.json());

const {
data,
isLoading,
isError,
mutate,
} = useSWR(
`https://nhdd-staging-api.health.go.ke/concepts/?q=${searchParams}&verbose=false&includeRetired=false&includeInverseMappings=false`,
fetcher,
{ revalidateOnFocus: false, revalidateOnReconnect: false }
);

return {
data, isLoading, isError, mutate
}
}
Loading

0 comments on commit 20e4859

Please sign in to comment.