Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Move loadCurrentUser in App to a thunk #237

Closed
@kumar303

Description

@kumar303

As of #12 we can move the async logic in App.componentDidUpdate to a thunk. This will make testing easier.

async componentDidUpdate(prevProps: Props) {
const { apiState, dispatch, profile } = this.props;
if (!profile && prevProps.apiState.authToken !== apiState.authToken) {
const response = (await api.callApi({
apiState,
endpoint: '/accounts/profile/',
})) as ExternalUser;
if (response && response.name) {
dispatch(userActions.loadCurrentUser({ user: response }));
}
}
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions