Guest adjustments

This commit is contained in:
William Buezas 2025-04-22 11:39:01 +02:00
parent 79d30373f8
commit 52fe0f9f55
2 changed files with 9 additions and 8 deletions

View File

@ -21,6 +21,7 @@ import { storeToRefs } from 'pinia';
import { formatDateTitle, currency } from 'src/lib/filters.js';
import useNotify from 'src/composables/useNotify.js';
import debounce from 'src/utils/debouncer.js';
import app from 'src/boot/app';
const jApi = inject('jApi');
const api = inject('api');
@ -671,11 +672,10 @@ onBeforeMount(async () => {
if (!isGuest.value) {
await appStore.check('catalog');
} else {
const resultSet = await jApi.execQuery(
'CALL myOrder_configureForGuest(@orderId); SELECT @orderId;'
);
resultSet.fetchResult();
appStore.basketOrderId = resultSet.fetchValue();
const { data } = await api.post('Orders/configureForGuest');
const orderId = data[0]?.['@orderId'] || null;
appStore.basketOrderId = orderId;
console.log('appStore.basketOrderId', appStore.basketOrderId);
}
await getOrder();
await getCategories();

View File

@ -8,7 +8,6 @@ const { notify } = useNotify();
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
const TOKEN = 'token';
export const useUserStore = defineStore('user', () => {
const token = ref('');
const tokenMultimedia = ref('');
@ -33,7 +32,10 @@ export const useUserStore = defineStore('user', () => {
router = _router;
isGuest.value = localStorage.getItem('hederaGuest') || false;
await getToken();
if (!isLoggedIn.value) {
if (isGuest.value) {
fetchUser();
return;
} else if (!isLoggedIn.value) {
const autoLoginStatus = await tryAutoLogin();
if (!autoLoginStatus) {
router.push({ name: 'login' });
@ -291,7 +293,6 @@ export const useUserStore = defineStore('user', () => {
companyId.value = data.companyFk;
};
const $reset = () => {
token.value = '';
tokenMultimedia.value = '';