feat: add firearm management features
- 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.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user