Merge pull request 'Guest adjustments' (!147) from wbuezas/hedera-web-mindshore:feature/guest-adjustments into beta
gitea/hedera-web/pipeline/head There was a failure building this commit
Details
gitea/hedera-web/pipeline/head There was a failure building this commit
Details
Reviewed-on: #147 Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
a8277a2473
|
@ -22,7 +22,6 @@ import { formatDateTitle, currency } from 'src/lib/filters.js';
|
|||
import useNotify from 'src/composables/useNotify.js';
|
||||
import debounce from 'src/utils/debouncer.js';
|
||||
|
||||
const jApi = inject('jApi');
|
||||
const api = inject('api');
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
|
@ -671,11 +670,9 @@ 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;
|
||||
}
|
||||
await getOrder();
|
||||
await getCategories();
|
||||
|
|
|
@ -32,8 +32,7 @@ export const useAppStore = defineStore('hedera', {
|
|||
}),
|
||||
actions: {
|
||||
async getMenuLinks() {
|
||||
const { data: sections } = await api.get('MyMenus');
|
||||
|
||||
const { data: sections } = await api.get('MyMenus/myMenu');
|
||||
if (!sections) return;
|
||||
|
||||
const sectionMap = new Map();
|
||||
|
@ -92,14 +91,21 @@ export const useAppStore = defineStore('hedera', {
|
|||
|
||||
async checkRedirect(checkoutContinue) {
|
||||
const orderId = this.basketOrderId;
|
||||
const myOrder_checkConfig = await api.post('applications/myOrder_checkConfig/execute-proc', {
|
||||
const myOrder_checkConfig = await api.post(
|
||||
'applications/myOrder_checkConfig/execute-proc',
|
||||
{
|
||||
schema: 'hedera',
|
||||
params: [orderId],
|
||||
}, {
|
||||
validateStatus: () => true,
|
||||
});
|
||||
params: [orderId]
|
||||
},
|
||||
{
|
||||
validateStatus: () => true
|
||||
}
|
||||
);
|
||||
|
||||
if (myOrder_checkConfig.status >= 200 && myOrder_checkConfig.status < 300) {
|
||||
if (
|
||||
myOrder_checkConfig.status >= 200 &&
|
||||
myOrder_checkConfig.status < 300
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
await 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