File tree Expand file tree Collapse file tree 2 files changed +778
-383
lines changed
packages/homepage/src/components Expand file tree Collapse file tree 2 files changed +778
-383
lines changed Original file line number Diff line number Diff line change @@ -98,23 +98,21 @@ export default class Navigation extends React.PureComponent {
9898 user : null ,
9999 } ;
100100
101- fetchCurrentUser = async ( ) => {
102- try {
103- const jwt = JSON . parse ( localStorage . getItem ( 'jwt' ) ) ;
104-
105- const BASE =
106- process . env . NODE_ENV === 'development' ? 'https://codesandbox.dev' : '' ;
107-
108- const { data } = await window
109- . fetch ( BASE + '/api/v1/users/current' , {
110- headers : { Authorization : `Bearer ${ jwt } ` } ,
111- } )
112- . then ( x => x . json ( ) ) ;
113-
114- this . setState ( { user : data } ) ;
115- } catch ( e ) {
116- // fail silently
117- }
101+ fetchCurrentUser = ( ) => {
102+ const jwt = JSON . parse ( localStorage . getItem ( 'jwt' ) ) ;
103+
104+ const BASE =
105+ process . env . NODE_ENV === 'development' ? 'https://codesandbox.dev' : '' ;
106+
107+ window
108+ . fetch ( BASE + '/api/v1/users/current' , {
109+ headers : { Authorization : `Bearer ${ jwt } ` } ,
110+ } )
111+ . then ( x => x . json ( ) )
112+ . then ( ( { data } ) => this . setState ( { user : data } ) )
113+ . catch ( ( ) => {
114+ /* do nothing */
115+ } ) ;
118116 } ;
119117
120118 componentDidMount ( ) {
You can’t perform that action at this time.
0 commit comments