From 29c42d7f34fda9131dfe6325085238761d29e96e Mon Sep 17 00:00:00 2001 From: taro Date: Tue, 18 Feb 2025 00:32:34 -0300 Subject: [PATCH 01/16] refactor: migrate `fetchUser` API call from PHP to Salix --- src/stores/user.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/stores/user.js b/src/stores/user.js index 90aaa688..a81b3c2c 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -248,11 +248,13 @@ export const useUserStore = defineStore('user', () => { const fetchUser = async (userType = 'user') => { try { - const userData = await jApi.getObject( - 'SELECT id, nickname, name, lang FROM account.myUser' - ); - if (userType === 'user') mainUser.value = userData; - else supplantedUser.value = userData; + const _token = getToken(); + const userData = await api.get('VnUsers/getCurrentUserData', { + headers: { Authorization: _token } + }); + + if (userType === 'user') mainUser.value = userData.data; + else supplantedUser.value = userData.data; } catch (error) { console.error('Error fetching user: ', error); } From bf449548c9116521407a37ab5a98c76bf3fe2ae9 Mon Sep 17 00:00:00 2001 From: taro Date: Wed, 19 Feb 2025 02:05:42 -0300 Subject: [PATCH 02/16] =?UTF-8?q?address=20comments=20=E2=80=94=20remove?= =?UTF-8?q?=20unnecessary=20explicit=20passing=20of=20auth=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/user.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/stores/user.js b/src/stores/user.js index a81b3c2c..7f9d8a54 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -248,10 +248,7 @@ export const useUserStore = defineStore('user', () => { const fetchUser = async (userType = 'user') => { try { - const _token = getToken(); - const userData = await api.get('VnUsers/getCurrentUserData', { - headers: { Authorization: _token } - }); + const userData = await api.get('VnUsers/getCurrentUserData'); if (userType === 'user') mainUser.value = userData.data; else supplantedUser.value = userData.data; From 93c481aadf43084b994fae3a8f3e160e12ee76e5 Mon Sep 17 00:00:00 2001 From: taro Date: Wed, 19 Feb 2025 02:17:09 -0300 Subject: [PATCH 03/16] handle possible error case --- src/stores/user.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stores/user.js b/src/stores/user.js index 7f9d8a54..992e6e06 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -250,6 +250,11 @@ export const useUserStore = defineStore('user', () => { try { const userData = await api.get('VnUsers/getCurrentUserData'); + if (!userData?.data) { + console.error('GET VnUsers/getCurrentUserData returned invalid data', userData); + return; + } + if (userType === 'user') mainUser.value = userData.data; else supplantedUser.value = userData.data; } catch (error) { From e444266db4c2dfef7af86ff4b80f48625fafad1c Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 19 Feb 2025 13:39:00 -0300 Subject: [PATCH 04/16] My menu query adaptation --- src/stores/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stores/app.js b/src/stores/app.js index d950af10..71b3bb64 100644 --- a/src/stores/app.js +++ b/src/stores/app.js @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { jApi } from '@/boot/axios'; +import { jApi, api } from '@/boot/axios'; import useNotify from '@/composables/useNotify.js'; import { i18n } from '@/boot/i18n'; import { useQuasar } from 'quasar'; @@ -32,7 +32,10 @@ export const useAppStore = defineStore('hedera', { }), actions: { async getMenuLinks() { - const sections = await jApi.query('SELECT * FROM myMenu'); + const { data: sections } = await api.get('MyMenus/getSections'); + + if (!sections) return; + const sectionMap = new Map(); for (const section of sections) { sectionMap.set(section.id, section); From 4ad4cb17e85cd19419d344f67abeb6118f1a1322 Mon Sep 17 00:00:00 2001 From: taro Date: Thu, 20 Feb 2025 04:57:23 -0300 Subject: [PATCH 05/16] refactor: remove unnecessary verification --- src/stores/user.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/stores/user.js b/src/stores/user.js index 992e6e06..7f9d8a54 100644 --- a/src/stores/user.js +++ b/src/stores/user.js @@ -250,11 +250,6 @@ export const useUserStore = defineStore('user', () => { try { const userData = await api.get('VnUsers/getCurrentUserData'); - if (!userData?.data) { - console.error('GET VnUsers/getCurrentUserData returned invalid data', userData); - return; - } - if (userType === 'user') mainUser.value = userData.data; else supplantedUser.value = userData.data; } catch (error) { From a64a2a91f6f8708560fddc539ffe05f87e11f02d Mon Sep 17 00:00:00 2001 From: taro Date: Mon, 24 Feb 2025 17:59:45 -0300 Subject: [PATCH 06/16] feat(HomeView): use salix for news --- src/pages/Cms/HomeView.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/Cms/HomeView.vue b/src/pages/Cms/HomeView.vue index a9931ca9..3546a4cb 100644 --- a/src/pages/Cms/HomeView.vue +++ b/src/pages/Cms/HomeView.vue @@ -1,16 +1,15 @@