Skip to content

Commit 51ae741

Browse files
author
Ives van Hoorne
committed
Fix local server building
1 parent eaf0ecb commit 51ae741

File tree

2 files changed

+15
-42
lines changed

2 files changed

+15
-42
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() {

yarn.lock

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5798,13 +5798,6 @@ gatsby-plugin-sitemap@^1.2.7:
57985798
babel-runtime "^6.26.0"
57995799
sitemap "^1.12.0"
58005800

5801-
gatsby-plugin-styled-components@^1.0.5:
5802-
version "1.0.5"
5803-
resolved "https://registry.yarnpkg.com/gatsby-plugin-styled-components/-/gatsby-plugin-styled-components-1.0.5.tgz#14a5d24b63451e80931db0ed68c6312d8cf1f104"
5804-
dependencies:
5805-
babel-runtime "^6.26.0"
5806-
styled-components "^2.0.0"
5807-
58085801
gatsby-plugin-styled-components@^2.0.5:
58095802
version "2.0.5"
58105803
resolved "https://registry.yarnpkg.com/gatsby-plugin-styled-components/-/gatsby-plugin-styled-components-2.0.5.tgz#3d881748eb5c3666cc82783de39a912a9f31e640"
@@ -14133,20 +14126,6 @@ style-loader@^0.18.2:
1413314126
loader-utils "^1.0.2"
1413414127
schema-utils "^0.3.0"
1413514128

14136-
styled-components@^2.0.0:
14137-
version "2.2.3"
14138-
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-2.2.3.tgz#154575c269880c840f903f580287dab155cf684c"
14139-
dependencies:
14140-
buffer "^5.0.3"
14141-
css-to-react-native "^2.0.3"
14142-
fbjs "^0.8.9"
14143-
hoist-non-react-statics "^1.2.0"
14144-
is-function "^1.0.1"
14145-
is-plain-object "^2.0.1"
14146-
prop-types "^15.5.4"
14147-
stylis "3.x"
14148-
supports-color "^3.2.3"
14149-
1415014129
styled-components@^3.1.4:
1415114130
version "3.1.4"
1415214131
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-3.1.4.tgz#1bdc1409c9bacafee3510c573d23b73039b0d875"
@@ -14165,10 +14144,6 @@ stylis-rule-sheet@^0.0.7:
1416514144
version "0.0.7"
1416614145
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.7.tgz#5c51dc879141a61821c2094ba91d2cbcf2469c6c"
1416714146

14168-
14169-
version "3.4.3"
14170-
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.4.3.tgz#875bd0db3db37bb6de08f89275fc38ee2e32ee75"
14171-
1417214147
stylis@^3.0.0:
1417314148
version "3.4.8"
1417414149
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.4.8.tgz#94380babbcd4c75726215794ca985b38ec96d1a3"

0 commit comments

Comments
 (0)