@@ -4,7 +4,7 @@ import { useEffect, useState, Suspense } from "react";
44import { useRouter , useSearchParams } from "next/navigation" ;
55import Link from "next/link" ;
66import { useAuth } from "../contexts/AuthContext" ;
7- import { apiClient } from "../lib/api" ;
7+ import { apiClient , SessionExpiredError } from "../lib/api" ;
88import toast from "react-hot-toast" ;
99
1010function AcceptInviteContent ( ) {
@@ -27,9 +27,13 @@ function AcceptInviteContent() {
2727 setSuccess ( true ) ;
2828 toast . success ( "Invite accepted successfully!" ) ;
2929 setTimeout ( ( ) => {
30- router . push ( "/vaults " ) ;
30+ router . push ( "/dashboard " ) ;
3131 } , 2000 ) ;
3232 } catch ( error ) {
33+ // Don't show toast for session expiration - it's already handled in API client
34+ if ( error instanceof SessionExpiredError ) {
35+ return ;
36+ }
3337 const errorMessage =
3438 error instanceof Error ? error . message : "Failed to accept invite" ;
3539 toast . error ( errorMessage ) ;
@@ -86,6 +90,10 @@ function AcceptInviteContent() {
8690 }
8791 }
8892 } catch ( error ) {
93+ // Don't show toast for session expiration - it's already handled in API client
94+ if ( error instanceof SessionExpiredError ) {
95+ return ;
96+ }
8997 const errorMessage =
9098 error instanceof Error ? error . message : "Failed to validate invite" ;
9199 console . error ( "Error checking invite:" , error ) ;
@@ -148,15 +156,15 @@ function AcceptInviteContent() {
148156 />
149157 </ svg >
150158 </ div >
151- < h1 className = "text-3xl font-bold text-slate-100 mb-4" >
159+ < h1 className = "text-2xl md:text- 3xl font-bold text-slate-100 mb-4" >
152160 Invite Accepted!
153161 </ h1 >
154162 < p className = "text-slate-400 mb-6" >
155163 You've successfully joined the vault. Redirecting to your
156- vaults...
164+ vaults.
157165 </ p >
158166 < Link
159- href = "/vaults "
167+ href = "/dashboard "
160168 className = "inline-block px-6 py-3 bg-gradient-to-r from-indigo-500 to-purple-500 text-white font-semibold rounded-lg hover:from-indigo-600 hover:to-purple-600 transition-all duration-200"
161169 >
162170 Go to Vaults
@@ -170,14 +178,14 @@ function AcceptInviteContent() {
170178 return (
171179 < div className = "min-h-screen bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/50 flex items-center justify-center" >
172180 < div className = "text-center bg-slate-800/60 backdrop-blur-md rounded-3xl p-12 border border-slate-700/50 shadow-2xl max-w-md" >
173- < h1 className = "text-3xl font-bold text-slate-100 mb-4" >
181+ < h1 className = "text-2xl md:text- 3xl font-bold text-slate-100 mb-4" >
174182 Invalid Invite
175183 </ h1 >
176184 < p className = "text-slate-400 mb-6" >
177185 This invite link is invalid or missing a token.
178186 </ p >
179187 < Link
180- href = "/vaults "
188+ href = "/dashboard "
181189 className = "inline-block px-6 py-3 bg-gradient-to-r from-indigo-500 to-purple-500 text-white font-semibold rounded-lg hover:from-indigo-600 hover:to-purple-600 transition-all duration-200"
182190 >
183191 Go to Vaults
0 commit comments