Skip to content

Commit eaf0ecb

Browse files
author
Ives van Hoorne
committed
Revert "Fix gatsby building"
This reverts commit 5b5707e.
1 parent 0ce68e6 commit eaf0ecb

File tree

2 files changed

+383
-778
lines changed

2 files changed

+383
-778
lines changed

packages/homepage/src/components/Navigation.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,23 @@ export default class Navigation extends React.PureComponent {
9898
user: null,
9999
};
100100

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-
});
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+
}
116118
};
117119

118120
componentDidMount() {

0 commit comments

Comments
 (0)