@vue-storefront/middleware@4.1.0
github-actions
released this
06 Jun 14:18
·
136 commits
to main
since this release
Minor Changes
- [CHANGED] Middleware extension hooks and the onCreate function can now be asynchronous. Examples:
// middleware.config.ts
const middlewareExtension = {
name: "example-extension",
hooks: () => ({
beforeCreate: async ({ configuration }) => Promise.resolve(configuration),
afterCreate: async ({ configuration }) => Promise.resolve(configuration),
beforeCall: async ({ args }) => Promise.resolve(args),
afterCall: async ({ response }) => Promise.resolve(response),
}),
};
// index.server.ts
import { apiClientFactory } from "@vue-storefront/middleware";
const { createApiClient } = apiClientFactory({
onCreate: async (config) =>
Promise.resolve({
config,
client: {},
}),
api: {},
});
export { createApiClient };