-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact: proper one-way data flow from URL -> Redux in search
- Loading branch information
1 parent
db705b0
commit 2edb7a7
Showing
5 changed files
with
68 additions
and
47 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import type { QueryParams } from '@/types/search'; | ||
|
||
export const queryParamsWithoutKey = (qp: QueryParams, key: string): QueryParams => { | ||
const qpc = { ...qp }; | ||
delete qpc[key]; | ||
return qpc; | ||
}; | ||
|
||
export const buildQueryParamsUrl = (pathName: string, qp: QueryParams): string => | ||
`${pathName}?${new URLSearchParams(qp).toString()}`; |