gatsby-source-strapi
gatsby-source-strapi copied to clipboard
Support plugin prefixes
Plugins such as i18n
include their own content types such as locale
that can be queried via the api as well.
Those are exposed on sub paths of the form /api/{plugin}/{pluralName}
.
When trying to fetch e.g. the locale
type, currently the request is made to /api/locales
as it is resolved through the fetched schema but the plugin prefix is not used although it can be derived from the plugin
field in the schema.
Why is this useful? Especially in the example case with locales, it can be used to query a list of all locales and their names in order to build e.g. a language switcher component.
@mwoelk I agree this would be an awesome feature, I tried to add such logic to the plugin but I faced a wall at some point with endpoints that does not respect the new API format which is the case for i18n.
I guess since the i18n plugin is a core feature we could make an exception for it in order to be able to query it.
cc @remidej @markkaylor