Skip to content

Commit

Permalink
fix: fixed the filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Paribesh01 committed Sep 5, 2024
1 parent 197e4fc commit 112c984
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/ui/paginator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const PaginationPages = ({
baseUrl: string;
}) => {
const setQueryParams = useSetQueryParams();

if (currentPage > totalPages) {
setQueryParams({ page: '1' });
}
function paginationHandler(page: number) {
setQueryParams({ page: page.toString() });
}
Expand Down
2 changes: 2 additions & 0 deletions src/layouts/job-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import { ScrollArea } from '@/components/ui/scroll-area';
import { cn } from '@/lib/utils';
import useSetQueryParams from '@/hooks/useSetQueryParams';
import { useEffect } from 'react';
import { DEFAULT_PAGE } from '@/config/app.config';

const JobFilters = ({ searchParams }: { searchParams: JobQuerySchemaType }) => {
const setQueryParams = useSetQueryParams();
const form = useForm<JobQuerySchemaType>({
resolver: zodResolver(JobQuerySchema),
defaultValues: {
page: DEFAULT_PAGE,
workmode: searchParams.workmode,
salaryrange: searchParams.salaryrange,
location: searchParams.location,
Expand Down

0 comments on commit 112c984

Please sign in to comment.