Skip to content

Commit 13e8c69

Browse files
committed
refactor(app): use await instead
1 parent 55d9fe6 commit 13e8c69

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/client/actions/authSignUpNSignIn.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default function authSignUpNSignIn(presets) {
1414
type: SET_PRESET,
1515
payload: res.data.presets,
1616
});
17-
return Promise.resolve();
1817
} catch({ response }) {
1918
console.log(response.data.error);
2019
}

packages/client/containers/App.jsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,15 @@ class App extends Component {
4444
window.addEventListener('message', this.onReceiveMessage);
4545
}
4646

47-
componentWillReceiveProps() {
47+
async componentWillReceiveProps() {
4848
const token = localStorage.getItem('token');
4949
// Sign in upon receiving user token
5050
if (!this.state.signIn && token) {
51-
this.props.authSignUpNSignIn(this.props.presets).then(() => {
52-
// Set sign in flag after received the preset data
53-
this.setState({
54-
signIn: true,
55-
showSignInDialog: false,
56-
});
51+
await this.props.authSignUpNSignIn(this.props.presets);
52+
// Set sign in flag after received the preset data
53+
this.setState({
54+
signIn: true,
55+
showSignInDialog: false,
5756
});
5857
}
5958
}

0 commit comments

Comments
 (0)