Skip to content

Merge strategy API for useDefaults #1570

Answered by patzick
patzick asked this question in RFC
Discussion options

You must be logged in to vote

Hey folks, I've come with another proposition to solve our case, I believe it's pretty clean and straightforward :)

Api defaults builder

You could be able to use it in nuxt config sile, shopware-pwa config file or move logic to dedicated file.

The base:

import defaultsConfigBuilder from "@shopware-pwa/nuxt-module/api-defaults"
// or in CJS
const defaultsConfigBuilder =
  require("@shopware-pwa/nuxt-module/api-defaults").default

console.info('defaultsConfigBuilder', defaultsConfigBuilder().get()); // will print default config

Now we could have many abilities to edit the config, I'll leave the API with examples

Adding new value

// merge object (including arrays), in this case add one value…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@patzick
Comment options

patzick Jun 21, 2021
Maintainer Author

Comment options

You must be logged in to vote
0 replies
Comment options

patzick
Jul 23, 2021
Maintainer Author

You must be logged in to vote
2 replies
@niklaswolf
Comment options

@patzick
Comment options

patzick Jul 26, 2021
Maintainer Author

Answer selected by patzick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
RFC
Labels
None yet
3 participants