'How to use Vuex store to manage registered users and guests (unregistered users)?

I currently have an application allowing users to purchase items, providing prior registration and login.

The stack is Vue (+Vuex) / Laravel. All users are registered in the app database and the Vuex store's user state is populated from the user's table in DB on login.

I would like to modify this process to allow guests to purchase without registering (like in some online store where you have the option to order with or without registration).

From an architectural perspective, how should I achieve this? I was thinking about creating a static "guest" user record in the database from which the Vuex store's user state will be initialised, then the store will be used during order and destroyed after. Is it the right path to go?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source