File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,18 @@ import { BrowserRouter as Router } from "react-router-dom";
9
9
import { getCSP } from "./csp" ;
10
10
11
11
const injectCSP = ( ) => {
12
- const cspContent = getCSP ( process . env ) ; // Pass environment variables
13
- const metaTag = document . createElement ( "meta" ) ;
14
- metaTag . httpEquiv = "Content-Security-Policy" ;
15
- metaTag . content = cspContent . trim ( ) ;
16
- document . head . appendChild ( metaTag ) ;
12
+ try {
13
+ const cspContent = getCSP ( process . env ) ; // Pass environment variables
14
+ const metaTag = document . createElement ( "meta" ) ;
15
+ metaTag . httpEquiv = "Content-Security-Policy" ;
16
+ metaTag . content = cspContent . trim ( ) ;
17
+ document . head . appendChild ( metaTag ) ;
18
+ } catch ( error ) {
19
+ console . error ( "Failed to inject CSP:" , error ) ;
20
+ }
17
21
} ;
18
22
19
- setTimeout ( ( ) => {
20
- injectCSP ( ) ;
21
- } , 0 ) ;
23
+ injectCSP ( ) ;
22
24
23
25
render (
24
26
< React . StrictMode >
You can’t perform that action at this time.
0 commit comments