Skip to content

Commit

Permalink
Merge pull request #106 from vuestorefront/fix/user_authentication
Browse files Browse the repository at this point in the history
fix(account): update register and logout flow
  • Loading branch information
Daniel Hajduk authored Jan 14, 2022
2 parents fd79e8d + 24253c1 commit b3879c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/api-client/src/api/logOut/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { ApiContext } from '../../types';

export default async function logOut({ config }: ApiContext): Promise<void> {
await config.auth.removeOAuthToken();
await config.auth.removeCartToken();
}
2 changes: 2 additions & 0 deletions packages/composables/src/useUser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const params: UseUserFactoryParams<User, any, any> = {

register: async (context: Context, { email, password, firstName, lastName }) => {
try {
const guestCartToken = context.cart?.value?.token;
await context.$spree.api.registerUser({ email, password, firstName, lastName });
await context.$spree.api.logIn({ username: email, password, guestCartToken });

return {};
} catch (e) {
Expand Down

0 comments on commit b3879c7

Please sign in to comment.