1
- import Link from ' next/link'
2
- import { useEffect } from ' react' ;
3
- import { toast , ToastContainer } from ' react-toastify' ;
4
- import ' react-toastify/dist/ReactToastify.css' ;
1
+ import Link from " next/link" ;
2
+ import { useEffect , useState } from " react" ;
3
+ import { toast , ToastContainer } from " react-toastify" ;
4
+ import " react-toastify/dist/ReactToastify.css" ;
5
5
6
6
const ErrorPage = ( { message } ) => {
7
+ const [ theme , setTheme ] = useState ( "dark" ) ; // Default to light theme
8
+
7
9
useEffect ( ( ) => {
8
10
// Display toast notification when component mounts
9
11
const toastId = toast . error ( 'Click "Re-authenticate" to continue.' , {
@@ -17,18 +19,22 @@ const ErrorPage = ({ message }) => {
17
19
} , [ ] ) ;
18
20
19
21
const handleReauthClick = ( ) => {
20
- toast . info ( ' Re-authenticating...' , {
22
+ toast . info ( " Re-authenticating..." , {
21
23
autoClose : 2000 ,
22
24
} ) ;
23
25
24
26
setTimeout ( ( ) => {
25
27
// Redirect to the dashboard page after waiting
26
- window . location . href = ' /dashboard' ;
28
+ window . location . href = " /dashboard" ;
27
29
} , 3000 ) ;
28
30
} ;
29
31
30
32
return (
31
- < div className = "flex flex-col items-center justify-center min-h-screen bg-white text-black" >
33
+ < div
34
+ className = { `flex flex-col items-center justify-center min-h-screen ${
35
+ theme === "dark" ? "bg-gray-900 text-white" : "bg-white text-black"
36
+ } `}
37
+ >
32
38
< p className = "text-lg mb-6" > { message } </ p >
33
39
< div className = "flex space-x-4 mt-4" >
34
40
< button
@@ -44,7 +50,11 @@ const ErrorPage = ({ message }) => {
44
50
Home
45
51
</ Link >
46
52
</ div >
47
- < ToastContainer position = "bottom-right" autoClose = { 3000 } />
53
+ < ToastContainer
54
+ position = "bottom-right"
55
+ autoClose = { 3000 }
56
+ theme = { theme === "dark" ? "dark" : "light" }
57
+ />
48
58
</ div >
49
59
) ;
50
60
} ;
0 commit comments