Skip to content
This repository was archived by the owner on May 20, 2021. It is now read-only.

Conversation

@pilot4u
Copy link

@pilot4u pilot4u commented Jun 17, 2019

added costume serializer adn deserializer to support JSON objects as parameters

added costume serializer adn deserializer to support JSON objects as parameters
@pilot4u
Copy link
Author

pilot4u commented Jun 17, 2019

Sample usage for those capabilities :
createBrowserApp(AppNavigator, { history: "hash", paramsSerializer: p => "params=" + JSON.stringify(p), paramsDeSerializer: p => JSON.parse(p.replace("?params=", "") || "{}") })

@infostreams
Copy link

infostreams commented Feb 3, 2020

Can this be merged please? @ericvicenti

EDIT: Just so that I can do

        createBrowserApp(SwitchNavigator, {
            paramsSerializer: params => {
                Object.keys(params).forEach(key => {
                    if ((typeof params[key] === 'function') || (typeof params[key] === 'object'))
                        delete params[key]
                })
                return queryString.stringify(params)
            },
            paramsDeSerializer: p => queryString.parse(p)
        })

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants