-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
543e074
commit fd1aa3d
Showing
21 changed files
with
1,542 additions
and
768 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,22 +1,25 @@ | ||
let generateDefaultUrl = dict => { | ||
dict | ||
->Js.Dict.entries | ||
->Belt.Array.keepMap(entry => { | ||
let (key, val) = entry | ||
|
||
let strValue = RemoteFiltersUtils.getStrFromJson(key, val) | ||
if strValue !== "" { | ||
Some(`${key}=${strValue}`) | ||
} else { | ||
None | ||
} | ||
let parseFilterString = queryString => { | ||
queryString | ||
->Js.Global.decodeURI | ||
->Js.String2.split("&") | ||
->Belt.Array.keepMap(str => { | ||
let arr = str->Js.String2.split("=") | ||
let key = arr->Belt.Array.get(0)->Belt.Option.getWithDefault("-") | ||
let val = arr->Belt.Array.sliceToEnd(1)->Js.Array2.joinWith("=") | ||
key === "" || val === "" ? None : Some((key, val)) | ||
}) | ||
->Js.Array2.joinWith("&") | ||
->Js.Dict.fromArray | ||
} | ||
|
||
let updateURLWithDefaultFilter = (~path, ~filterParam, ~filterString) => { | ||
if path->Js.String2.length > 0 && filterParam->Js.String2.length == 0 { | ||
let finalUrl = `${path}?${filterString}` | ||
RescriptReactRouter.replace(finalUrl) | ||
} | ||
let parseFilterDict = dict => { | ||
let searchParam = | ||
dict | ||
->Js.Dict.entries | ||
->Js.Array2.map(item => { | ||
let (key, value) = item | ||
`${key}=${value}` | ||
}) | ||
->Js.Array2.joinWith("&") | ||
|
||
searchParam | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.