Skip to content

Commit

Permalink
fix:fixed filter (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paribesh01 authored Sep 12, 2024
1 parent eecb394 commit f642425
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/ui/paginator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ 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 @@ -29,12 +29,14 @@ import useSetQueryParams from '@/hooks/useSetQueryParams';
import { useEffect } from 'react';
import { WorkMode } from '@prisma/client';
import _ from 'lodash';
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 f642425

Please sign in to comment.