File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2783,15 +2783,18 @@ function getConfiguredAxiosInstance(): AxiosInstance {
27832783 if ( process . env . NODE_ENV === "development" ) {
27842784 // Development mode uses a hard-coded CSRF token
27852785 instance . defaults . headers . common [ "X-CSRF-TOKEN" ] = csrfToken ;
2786- instance . defaults . headers . common [ "X-CSRF-TOKEN" ] = csrfToken ;
27872786 tokenMetadataElement . setAttribute ( "content" , csrfToken ) ;
27882787 } else {
27892788 instance . defaults . headers . common [ "X-CSRF-TOKEN" ] =
27902789 tokenMetadataElement . getAttribute ( "content" ) ?? "" ;
27912790 }
27922791 } else {
2793- // Do not write error logs if we are in a FE unit test.
2794- if ( ! process . env . JEST_WORKER_ID && ! process . env . VITEST ) {
2792+ // Do not write error logs if we are in a FE unit test or if there is no document (e.g., Electron)
2793+ if (
2794+ typeof document !== "undefined" &&
2795+ ! process . env . JEST_WORKER_ID &&
2796+ ! process . env . VITEST
2797+ ) {
27952798 console . error ( "CSRF token not found" ) ;
27962799 }
27972800 }
You can’t perform that action at this time.
0 commit comments