Skip to content

Commit

Permalink
Add client side searching
Browse files Browse the repository at this point in the history
  • Loading branch information
airelawaleria committed May 21, 2024
1 parent 79aaf7a commit 2cc135b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ export const ThesisApplicationsDatatable = (): JSX.Element => {
Query.THESIS_APPLICATION,
tablePage,
tablePageSize,
searchQuery,
sortStatus.columnAccessor,
sortStatus.direction,
],
queryFn: () =>
getThesisApplications(
tablePage - 1,
tablePageSize,
searchQuery,
sortStatus.columnAccessor,
sortStatus.direction,
),
Expand All @@ -74,13 +76,6 @@ export const ThesisApplicationsDatatable = (): JSX.Element => {

useEffect(() => {
const filteredSortedData = fetchedThesisApplications?.content
.filter(({ student }) => {
return `${student.firstName ?? ''} ${student.lastName ?? ''} ${student.tumId ?? ''} ${
student.matriculationNumber ?? ''
}`
.toLowerCase()
.includes(searchQuery.toLowerCase())
})
.filter(
(application) =>
filters.status.length === 0 || filters.status.includes(application.applicationStatus),
Expand Down
2 changes: 2 additions & 0 deletions client/src/network/thesisApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Pageable } from '../interface/pageable'
export const getThesisApplications = async (
page: number,
limit: number,
searchQuery?: string,
sortBy?: string,
sortOrder?: 'asc' | 'desc',
): Promise<Pageable<ThesisApplication>> => {
Expand All @@ -17,6 +18,7 @@ export const getThesisApplications = async (
params: {
page,
limit,
searchQuery,
sortBy,
sortOrder,
},
Expand Down

0 comments on commit 2cc135b

Please sign in to comment.