Skip to content

Commit 67ba4cf

Browse files
authored
fix(web): prevent clearing fallback header
If the cookie fallback isn't set in local storage, the X-Fallback-Cookies header is set to empty even if the default header has some value set. This change will only set the header if there's a value in local storage to allow developer to set the fallback header if they have a value from somewhere else.
1 parent 549eeeb commit 67ba4cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

templates/web/src/client.ts.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ class Client {
353353
};
354354

355355
if (typeof window !== 'undefined' && window.localStorage) {
356-
headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? '';
356+
const cookieFallback = window.localStorage.getItem('cookieFallback');
357+
if (cookieFallback) {
358+
headers['X-Fallback-Cookies'] = cookieFallback;
359+
}
357360
}
358361

359362
if (method === 'GET') {

0 commit comments

Comments
 (0)