File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
packages/app/src/app/store Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -364,7 +364,13 @@ export function getUser({ api, path }) {
364364 return api
365365 . get ( '/users/current' )
366366 . then ( data => path . success ( { user : data } ) )
367- . catch ( ( ) => path . error ( ) ) ;
367+ . catch ( e => {
368+ if ( e . response . status === 401 ) {
369+ return path . unauthorized ( ) ;
370+ }
371+
372+ return path . error ( ) ;
373+ } ) ;
368374}
369375
370376export function connectWebsocket ( { socket } ) {
@@ -380,8 +386,9 @@ export function setJwtFromStorage({ jwt, state }) {
380386 state . set ( 'jwt' , jwt . get ( ) || null ) ;
381387}
382388
383- export function removeJwtFromStorage ( { jwt } ) {
389+ export function removeJwtFromStorage ( { jwt, state } ) {
384390 jwt . reset ( ) ;
391+ state . set ( 'jwt' , null ) ;
385392}
386393
387394export function setSignedInCookie ( { props } ) {
Original file line number Diff line number Diff line change @@ -128,7 +128,13 @@ export function withLoadApp(continueSequence) {
128128 ] ,
129129 error : [
130130 addNotification (
131- 'Your session seems to be expired, please log in again...' ,
131+ "We weren't able to sign you in, this could be due to a flaky connection or something on our server. Please try again in a minute." ,
132+ 'error'
133+ ) ,
134+ ] ,
135+ unauthorized : [
136+ addNotification (
137+ 'Your session seems to be expired, please try to log in again...' ,
132138 'error'
133139 ) ,
134140 actions . removeJwtFromStorage ,
Original file line number Diff line number Diff line change @@ -453,6 +453,9 @@ export const signIn = [
453453 setupNotifications ,
454454 refetchSandboxInfo ,
455455 ] ,
456+ unauthorized : [
457+ factories . addNotification ( 'Github Authentication Error' , 'error' ) ,
458+ ] ,
456459 error : [
457460 factories . addNotification ( 'Github Authentication Error' , 'error' ) ,
458461 ] ,
@@ -473,7 +476,6 @@ export const signOut = [
473476 false : [ ] ,
474477 } ,
475478 actions . signOut ,
476- set ( state `jwt` , null ) ,
477479 actions . removeJwtFromStorage ,
478480 set ( state `user.id` , null ) ,
479481 set ( state `user.email` , null ) ,
You can’t perform that action at this time.
0 commit comments