From d8d7d61fca1be903bec1ac6e9b03abed6ea39bae Mon Sep 17 00:00:00 2001 From: Abizrh Date: Wed, 13 Aug 2025 13:17:21 +0700 Subject: [PATCH 1/8] =?UTF-8?q?=E2=9A=A1=20enhance=20(auth):=20clear=20sto?= =?UTF-8?q?re=20on=20401=20and=20redirect=20to=20/401?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/flow/patient/list.vue | 1 - app/components/pub/base/error.vue | 3 ++- app/composables/useXfetch.ts | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/components/flow/patient/list.vue b/app/components/flow/patient/list.vue index 8537ce3b..82c23eb5 100644 --- a/app/components/flow/patient/list.vue +++ b/app/components/flow/patient/list.vue @@ -6,7 +6,6 @@ import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next' const data = ref([]) const refSearchNav: RefSearchNav = { - onClick: () => { // open filter modal }, diff --git a/app/components/pub/base/error.vue b/app/components/pub/base/error.vue index c1ebc354..7f7bc4ea 100644 --- a/app/components/pub/base/error.vue +++ b/app/components/pub/base/error.vue @@ -43,7 +43,8 @@ const router = useRouter()
- + +
diff --git a/app/composables/useXfetch.ts b/app/composables/useXfetch.ts index 24518c18..e4e4c3ef 100644 --- a/app/composables/useXfetch.ts +++ b/app/composables/useXfetch.ts @@ -55,6 +55,10 @@ export async function xfetch( const status = fetchError.response?.status || 500 const resJson = fetchError.data + if (status === 401 && import.meta.client) { + clearStore() + } + if (resJson?.errors) { errors = resJson.errors } else if (resJson?.code && resJson?.message) { @@ -68,3 +72,10 @@ export async function xfetch( return { success, status_code: status, body, errors, error, message } } } + +function clearStore() { + const { $pinia } = useNuxtApp() + const userStore = useUserStore($pinia) + userStore.logout() + navigateTo('/401') +} From 929758fe00fc19fa5cd1aed6a58acda3018014ff Mon Sep 17 00:00:00 2001 From: Abizrh Date: Wed, 13 Aug 2025 13:24:56 +0700 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=8E=A8=20enhance=20(layout):=20improv?= =?UTF-8?q?e=20default=20layout=20styling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/flow/patient/list.vue | 4 ++-- app/components/pub/nav/header/prep.vue | 1 + app/layouts/default.vue | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/components/flow/patient/list.vue b/app/components/flow/patient/list.vue index 82c23eb5..3131d81d 100644 --- a/app/components/flow/patient/list.vue +++ b/app/components/flow/patient/list.vue @@ -28,7 +28,7 @@ const recItem = ref(null) const hreaderPrep: HeaderPrep = { title: 'Pasien', - icon: 'i-lucide-add', + icon: 'i-lucide-users', addNav: { label: 'Tambah', onClick: () => navigateTo('/patient/add'), @@ -101,7 +101,7 @@ provide('rec_item', recItem)