a0a5c835aa
- Implemented API for fetching firearms and firearm details. - Created a new page for displaying the list of firearms with search and filter options. - Added Redux slice for managing firearms state. - Integrated Redux Persist for state persistence. - Updated routing to include firearms page. - Removed obsolete modification codes data. - Enhanced UI with responsive grid layout for firearms display. - Added utility functions for handling URL query parameters.
23 lines
591 B
TypeScript
23 lines
591 B
TypeScript
import { PageQueryParams } from "@/types"
|
|
|
|
export function asUrlSearchParam(pageQueryParams?: PageQueryParams) {
|
|
const urlSearchParams = new URLSearchParams()
|
|
|
|
if (pageQueryParams?.page) {
|
|
urlSearchParams.append("page", "" + pageQueryParams.page)
|
|
}
|
|
|
|
if (pageQueryParams?.size) {
|
|
urlSearchParams.append("size", "" + pageQueryParams.size)
|
|
}
|
|
|
|
if (pageQueryParams?.sortBy) {
|
|
urlSearchParams.append("sortBy", pageQueryParams.sortBy)
|
|
}
|
|
|
|
if (pageQueryParams?.direction) {
|
|
urlSearchParams.append("direction", pageQueryParams.direction)
|
|
}
|
|
|
|
return urlSearchParams
|
|
} |