Guest adjustments
This commit is contained in:
parent
79d30373f8
commit
52fe0f9f55
|
@ -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();
|
||||
|
|
|
@ -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 = '';
|
||||
|
|
Loading…
Reference in New Issue