Skip to content

Commit

Permalink
fixed search paging
Browse files Browse the repository at this point in the history
  • Loading branch information
banders committed Oct 4, 2024
1 parent 34c41ac commit f24f579
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions admin-frontend/src/components/EmployersPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const searchText = ref<string | undefined>(undefined);
const selectedYears = ref<number[]>([]);
const maxSelectedYearShown = 2;
const pageSizeOptions = [1, 3, 10, 25, 50];
const pageSizeOptions = [10, 25, 50];
const pageSize = ref<number>(pageSizeOptions[1]);
const searchResults = ref<Employer[] | undefined>(undefined);
const totalNum = ref<number>(0);
Expand Down Expand Up @@ -193,17 +193,18 @@ function buildSort(sortOptions): EmployerSortType {
return sort;
}
async function search(options) {
async function search(options?) {
isSearching.value = true;
try {
const offset = 0;
const offset = options ? (options.page - 1) * options.itemsPerPage : 0;
const limit = pageSize.value;
const filter: EmployerFilterType = buildSearchFilters();
const sort: EmployerSortType = buildSort(options?.sortBy);
const resp = await ApiService.getEmployers(offset, limit, filter, sort);
searchResults.value = resp?.employers;
totalNum.value = resp?.employers.length;
totalNum.value = resp?.total;
} catch (e) {
console.log(e);
NotificationService.pushNotificationError('Unable to search employers');
} finally {
hasSearched.value = true;
Expand Down

0 comments on commit f24f579

Please sign in to comment.