File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
app/dashboard/virtual-keys/components/VirtualKeysTable Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -105,18 +105,19 @@ const VirtualKeysTable = ({
105
105
106
106
// Add a useEffect to call refresh when a key is created
107
107
useEffect ( ( ) => {
108
- if ( refresh ) {
109
- const handleStorageChange = ( ) => {
110
- refresh ( ) ;
111
- } ;
108
+ if ( ! refresh || typeof window === "undefined" ) {
109
+ return ;
110
+ }
111
+ const handleStorageChange = ( ) => {
112
+ refresh ( ) ;
113
+ } ;
112
114
113
- // Listen for storage events that might indicate a key was created
114
- window . addEventListener ( "storage" , handleStorageChange ) ;
115
+ // Listen for storage events that might indicate a key was created
116
+ window . addEventListener ( "storage" , handleStorageChange ) ;
115
117
116
- return ( ) => {
117
- window . removeEventListener ( "storage" , handleStorageChange ) ;
118
- } ;
119
- }
118
+ return ( ) => {
119
+ window . removeEventListener ( "storage" , handleStorageChange ) ;
120
+ } ;
120
121
} , [ refresh ] ) ;
121
122
122
123
const columns : ColumnDef < KeyResponse > [ ] = [
Original file line number Diff line number Diff line change 6
6
* Clears the token cookie from both root and /ui paths
7
7
*/
8
8
export function clearTokenCookies ( ) {
9
+ if ( typeof window === "undefined" || typeof document === "undefined" ) {
10
+ return ;
11
+ }
12
+
9
13
// Get the current domain
10
14
const domain = window . location . hostname ;
11
15
You can’t perform that action at this time.
0 commit comments