Skip to content

Instantly share code, notes, and snippets.

@hpierre74
Last active June 13, 2021 19:14
Show Gist options
  • Save hpierre74/e3a4e4ef5c569ea56b2740310c9c88c4 to your computer and use it in GitHub Desktop.
Save hpierre74/e3a4e4ef5c569ea56b2740310c9c88c4 to your computer and use it in GitHub Desktop.
import { addUserProfile } from '@lib/user.actions';
export const createProfile = ({ profileName, profileId, avatarUrl }) => async (dispatch, getState) => {
await fetch('/api/profile', { method: 'POST', body: JSON.stringify({ profileId, profileName, avatarUrl }) });
dispatch(addUserProfile(profileId));
return dispatch({ type: 'CREATE_PROFILE', payload: { profileId, profileName, avatarUrl });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment