Skip to content

Commit

Permalink
feat: add new request header for configId + no cache in env (plentyma…
Browse files Browse the repository at this point in the history
  • Loading branch information
abocsan-plenty authored Oct 15, 2024
1 parent 4705115 commit 60afebe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export default defineNuxtConfig({
headerLogo: process.env.LOGO || '/images/logo.svg',
homepageCategoryId: Number(process.env.HOMEPAGE) ?? null,
storename: process.env.STORENAME || 'PLENTYSYSTEMS AG',
noCache: process.env.NO_CACHE || '',
configId: process.env.CONFIG_ID || '',
},
},
modules: [
Expand Down
5 changes: 4 additions & 1 deletion apps/web/sdk.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ const createHttpClient = () => {
if (tryUseNuxtApp()) {
const { token } = useCsrfToken();
const { $i18n } = useNuxtApp();
const runtimeConfig = useRuntimeConfig();
const referrerId = useRoute().query?.ReferrerID?.toString() ?? '';
const noCache = useRoute().query?.noCache?.toString() ?? '';
const noCache = runtimeConfig.public.noCache || useRoute().query?.noCache?.toString() || '';
const configId = runtimeConfig.public.configId;

client.interceptors.request.use((request) => {
if (token.value) request.headers['x-csrf-token'] = token.value;
if (referrerId) request.headers['referrerID'] = referrerId;
if (noCache) request.headers['noCache'] = noCache;
if (configId) request.headers['x-config-id'] = configId;
if (import.meta.server) {
request.headers['cookie'] = updateVsfLocale(request.headers['cookie'], $i18n.locale.value);
}
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v1.x.x (yyyy-mm-dd)

### New

- Added a new request header for configId and added no cache to environment variables.

### 🩹 Fixed

- Fixed an issue where product path was not reactive when category was changed.
Expand Down

0 comments on commit 60afebe

Please sign in to comment.