Skip to content

Commit 5b5707e

Browse files
author
Ives van Hoorne
committed
Fix gatsby building
1 parent 99cf8f2 commit 5b5707e

File tree

2 files changed

+778
-383
lines changed

2 files changed

+778
-383
lines changed

packages/homepage/src/components/Navigation.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)