File tree Expand file tree Collapse file tree 3 files changed +26
-7
lines changed
routes/(authentication)/login Expand file tree Collapse file tree 3 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 1111 function logout () {
1212 if (browser){
1313 localStorage .removeItem (' user' );
14- }
14+ }
1515 goto (' login' );
1616 };
1717 </script >
3939 /> <span key ="t-settings" >{$_ (' Settings' )}</span >
4040 </DropdownItem >
4141 <DropdownItem divider />
42- <DropdownItem href ="#" on:click ={logout }>
43- <div >
42+ <DropdownItem href =" #" >
43+ <div
44+ role =" button"
45+ tabindex =" 0"
46+ on:keydown ={() => {}}
47+ on:click ={logout }
48+ >
4449 <i class ="bx bx-power-off font-size-16 align-middle me-1 text-danger" /> <span >{$_ (' Logout' )}</span >
4550 </div >
4651 </DropdownItem >
Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ axios.interceptors.response.use(
3939 if ( error . response && error . response . status === 401 ) {
4040 // Perform actions like redirecting to the login page or refreshing tokens
4141 // Example: redirect to the login page
42- window . location . href = 'login' ;
42+ const curUrl = window . location . pathname + window . location . search ;
43+ let loginUrl = 'login' ;
44+ if ( curUrl ) {
45+ loginUrl += `?redirect=${ encodeURIComponent ( curUrl ) } ` ;
46+ }
47+ window . location . href = loginUrl ;
4348 }
4449
4550 // Return the error to the calling function
Original file line number Diff line number Diff line change 1616 import Headtitle from ' $lib/common/HeadTitle.svelte' ;
1717 import { getToken } from ' $lib/services/auth-service.js' ;
1818 import { goto } from ' $app/navigation' ;
19+ import { page } from ' $app/stores' ;
1920 import {
2021 PUBLIC_SERVICE_URL ,
2122 PUBLIC_LIVECHAT_HOST ,
5960 isOpen = true ;
6061 msg = ' Authentication success' ;
6162 status = ' success' ;
62- goto (' page/dashboard' );
63+ const redirectUrl = $page .url .searchParams .get (' redirect' );
64+ if (redirectUrl) {
65+ window .location .href = decodeURIComponent (redirectUrl);
66+ } else {
67+ goto (' page/dashboard' );
68+ }
6369 isSubmitting = false ;
6470 });
6571 isSubmitting = false ;
146152 type =" button"
147153 id =" password-addon"
148154 on:click ={() => onPasswordToggle ()}
149- ><i id =" password-eye-icon" class =" mdi mdi-eye-outline" /></Button
150155 >
156+ <i id =" password-eye-icon" class =" mdi mdi-eye-outline" />
157+ </Button >
151158 </div >
152159 </div >
153160
166173 color =" primary"
167174 disabled ={isSubmitting }
168175 class =" waves-effect waves-light"
169- type ="submit" >{ ! isSubmitting ? ' Log In ' : ' Log In... ' }</ Button
176+ type =" submit"
170177 >
178+ {! isSubmitting ? ' Log In' : ' Log In...' }
179+ </Button >
171180 </div >
172181
173182 <div class =" mt-4 text-center" >
You can’t perform that action at this time.
0 commit comments