-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ClientList, WalkRating and Changelog and ContentCollapse to v…
…uetify 2 #248
- Loading branch information
1 parent
efbd532
commit 052cb2a
Showing
12 changed files
with
634 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
import apiClient from '../api'; | ||
import dayjs from 'dayjs'; | ||
|
||
const updateFilterParams = function (params) { | ||
let sort = ''; | ||
if (params.sortBy) { | ||
sort = `&order[${params.sortBy}]=${params.sortDesc ? 'desc' : 'asc'}`; | ||
} | ||
if (typeof params?.filter !== "object") { | ||
return sort; | ||
} | ||
for (const [key, value] of Object.entries(params.filter)) { | ||
if (value === null || value === undefined || '' === value) { | ||
} else if (Array.isArray(value)) { | ||
value.forEach((iri) => { | ||
sort += `&${key}[]=${iri}`; | ||
}); | ||
} else if ('startTime' === key) { | ||
if (value.startDate && value.endDate) { | ||
sort += `&${key}[after]=${dayjs(value.startDate).startOf('day').toISOString()}&${key}[before]=${dayjs(value.endDate).endOf('day').toISOString()}`; | ||
} | ||
} else { | ||
sort += `&${key}=${value}`; | ||
} | ||
} | ||
|
||
return sort; | ||
}; | ||
|
||
export default { | ||
find(params) { | ||
let sort = updateFilterParams(params); | ||
|
||
return apiClient.get(`/api/clients?page=${params.page}&itemsPerPage=${params.itemsPerPage}` + sort); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.