diff --git a/apps/portal/auto-imports.d.ts b/apps/portal/auto-imports.d.ts index 72bfd79a..cf763eef 100644 --- a/apps/portal/auto-imports.d.ts +++ b/apps/portal/auto-imports.d.ts @@ -375,7 +375,6 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface GlobalComponents {} interface ComponentCustomProperties { - readonly COOKIE_MAX_AGE_1_YEAR: UnwrapRef readonly EffectScope: UnwrapRef readonly acceptHMRUpdate: UnwrapRef readonly alphaDashValidator: UnwrapRef diff --git a/apps/portal/env.d.ts b/apps/portal/env.d.ts index 5bf2874e..4bd4b4cf 100644 --- a/apps/portal/env.d.ts +++ b/apps/portal/env.d.ts @@ -1,12 +1,11 @@ import 'vue-router' declare module 'vue-router' { interface RouteMeta { - action?: string - subject?: string layoutWrapperClasses?: string navActiveLink?: RouteLocationRaw - layout?: 'blank' | 'default' - unauthenticatedOnly?: boolean + layout?: 'blank' | 'default' | 'portal' + requiresAuth?: boolean + requiresToken?: boolean public?: boolean } } diff --git a/apps/portal/src/App.vue b/apps/portal/src/App.vue index e6d6d1f3..a944605d 100644 --- a/apps/portal/src/App.vue +++ b/apps/portal/src/App.vue @@ -2,25 +2,18 @@ import { useTheme } from 'vuetify' import ScrollToTop from '@core/components/ScrollToTop.vue' import initCore from '@core/initCore' -import { initConfigStore, useConfigStore } from '@core/stores/config' +import { initConfigStore } from '@core/stores/config' import { hexToRgb } from '@core/utils/colorConverter' const { global } = useTheme() -// ℹ️ Sync current theme with initial loader theme initCore() initConfigStore() - -const configStore = useConfigStore() diff --git a/apps/portal/src/components/AppPricing.vue b/apps/portal/src/components/AppPricing.vue deleted file mode 100644 index f8b51ae5..00000000 --- a/apps/portal/src/components/AppPricing.vue +++ /dev/null @@ -1,247 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/AppSearchHeader.vue b/apps/portal/src/components/AppSearchHeader.vue deleted file mode 100644 index 9c8a5bd2..00000000 --- a/apps/portal/src/components/AppSearchHeader.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/ErrorHeader.vue b/apps/portal/src/components/ErrorHeader.vue deleted file mode 100644 index e4d99ed6..00000000 --- a/apps/portal/src/components/ErrorHeader.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/AddAuthenticatorAppDialog.vue b/apps/portal/src/components/dialogs/AddAuthenticatorAppDialog.vue deleted file mode 100644 index 92dcf603..00000000 --- a/apps/portal/src/components/dialogs/AddAuthenticatorAppDialog.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/AddEditAddressDialog.vue b/apps/portal/src/components/dialogs/AddEditAddressDialog.vue deleted file mode 100644 index 03b075bb..00000000 --- a/apps/portal/src/components/dialogs/AddEditAddressDialog.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/AddEditPermissionDialog.vue b/apps/portal/src/components/dialogs/AddEditPermissionDialog.vue deleted file mode 100644 index 4f888b12..00000000 --- a/apps/portal/src/components/dialogs/AddEditPermissionDialog.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/AddEditRoleDialog.vue b/apps/portal/src/components/dialogs/AddEditRoleDialog.vue deleted file mode 100644 index a9a2baa0..00000000 --- a/apps/portal/src/components/dialogs/AddEditRoleDialog.vue +++ /dev/null @@ -1,302 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/AddPaymentMethodDialog.vue b/apps/portal/src/components/dialogs/AddPaymentMethodDialog.vue deleted file mode 100644 index 4814d155..00000000 --- a/apps/portal/src/components/dialogs/AddPaymentMethodDialog.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/CardAddEditDialog.vue b/apps/portal/src/components/dialogs/CardAddEditDialog.vue deleted file mode 100644 index b31f38e7..00000000 --- a/apps/portal/src/components/dialogs/CardAddEditDialog.vue +++ /dev/null @@ -1,153 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/ConfirmDialog.vue b/apps/portal/src/components/dialogs/ConfirmDialog.vue deleted file mode 100644 index c3dd2b0a..00000000 --- a/apps/portal/src/components/dialogs/ConfirmDialog.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/CreateAppDialog.vue b/apps/portal/src/components/dialogs/CreateAppDialog.vue deleted file mode 100644 index c627b4e8..00000000 --- a/apps/portal/src/components/dialogs/CreateAppDialog.vue +++ /dev/null @@ -1,459 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/EnableOneTimePasswordDialog.vue b/apps/portal/src/components/dialogs/EnableOneTimePasswordDialog.vue deleted file mode 100644 index 3521ee2e..00000000 --- a/apps/portal/src/components/dialogs/EnableOneTimePasswordDialog.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/PaymentProvidersDialog.vue b/apps/portal/src/components/dialogs/PaymentProvidersDialog.vue deleted file mode 100644 index 9f73a3bc..00000000 --- a/apps/portal/src/components/dialogs/PaymentProvidersDialog.vue +++ /dev/null @@ -1,122 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/PricingPlanDialog.vue b/apps/portal/src/components/dialogs/PricingPlanDialog.vue deleted file mode 100644 index 0ce068a1..00000000 --- a/apps/portal/src/components/dialogs/PricingPlanDialog.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/ReferAndEarnDialog.vue b/apps/portal/src/components/dialogs/ReferAndEarnDialog.vue deleted file mode 100644 index 58cb10dc..00000000 --- a/apps/portal/src/components/dialogs/ReferAndEarnDialog.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/ShareProjectDialog.vue b/apps/portal/src/components/dialogs/ShareProjectDialog.vue deleted file mode 100644 index 8e50119b..00000000 --- a/apps/portal/src/components/dialogs/ShareProjectDialog.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - - diff --git a/apps/portal/src/components/dialogs/TwoFactorAuthDialog.vue b/apps/portal/src/components/dialogs/TwoFactorAuthDialog.vue deleted file mode 100644 index caa55090..00000000 --- a/apps/portal/src/components/dialogs/TwoFactorAuthDialog.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/UserInfoEditDialog.vue b/apps/portal/src/components/dialogs/UserInfoEditDialog.vue deleted file mode 100644 index 27afdda9..00000000 --- a/apps/portal/src/components/dialogs/UserInfoEditDialog.vue +++ /dev/null @@ -1,242 +0,0 @@ - - - diff --git a/apps/portal/src/components/dialogs/UserUpgradePlanDialog.vue b/apps/portal/src/components/dialogs/UserUpgradePlanDialog.vue deleted file mode 100644 index 0bbcb64c..00000000 --- a/apps/portal/src/components/dialogs/UserUpgradePlanDialog.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/DefaultLayoutWithHorizontalNav.vue b/apps/portal/src/layouts/components/DefaultLayoutWithHorizontalNav.vue deleted file mode 100644 index 61141e8b..00000000 --- a/apps/portal/src/layouts/components/DefaultLayoutWithHorizontalNav.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/DefaultLayoutWithVerticalNav.vue b/apps/portal/src/layouts/components/DefaultLayoutWithVerticalNav.vue deleted file mode 100644 index e4b8d808..00000000 --- a/apps/portal/src/layouts/components/DefaultLayoutWithVerticalNav.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/Footer.vue b/apps/portal/src/layouts/components/Footer.vue deleted file mode 100644 index 3b8f6dbe..00000000 --- a/apps/portal/src/layouts/components/Footer.vue +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/apps/portal/src/layouts/components/NavBarNotifications.vue b/apps/portal/src/layouts/components/NavBarNotifications.vue deleted file mode 100644 index 0c2faabd..00000000 --- a/apps/portal/src/layouts/components/NavBarNotifications.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/NavSearchBar.vue b/apps/portal/src/layouts/components/NavSearchBar.vue deleted file mode 100644 index c8a864e3..00000000 --- a/apps/portal/src/layouts/components/NavSearchBar.vue +++ /dev/null @@ -1,266 +0,0 @@ - - - - - diff --git a/apps/portal/src/layouts/components/NavbarShortcuts.vue b/apps/portal/src/layouts/components/NavbarShortcuts.vue deleted file mode 100644 index 14907319..00000000 --- a/apps/portal/src/layouts/components/NavbarShortcuts.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/NavbarThemeSwitcher.vue b/apps/portal/src/layouts/components/NavbarThemeSwitcher.vue deleted file mode 100644 index bb8519a7..00000000 --- a/apps/portal/src/layouts/components/NavbarThemeSwitcher.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/components/UserProfile.vue b/apps/portal/src/layouts/components/UserProfile.vue deleted file mode 100644 index 6f58f09b..00000000 --- a/apps/portal/src/layouts/components/UserProfile.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/apps/portal/src/layouts/default.vue b/apps/portal/src/layouts/default.vue index 7873cd87..d594cc42 100644 --- a/apps/portal/src/layouts/default.vue +++ b/apps/portal/src/layouts/default.vue @@ -1,56 +1,7 @@ - - diff --git a/apps/portal/src/layouts/portal.vue b/apps/portal/src/layouts/portal.vue new file mode 100644 index 00000000..c47f1f83 --- /dev/null +++ b/apps/portal/src/layouts/portal.vue @@ -0,0 +1,142 @@ + + + diff --git a/apps/portal/src/lib/axios.ts b/apps/portal/src/lib/axios.ts index 6b4397c9..21724c31 100644 --- a/apps/portal/src/lib/axios.ts +++ b/apps/portal/src/lib/axios.ts @@ -1,29 +1,23 @@ import axios from 'axios' -import { parse } from 'cookie-es' import type { AxiosInstance, InternalAxiosRequestConfig } from 'axios' +import { useAuthStore } from '@/stores/useAuthStore' const apiClient: AxiosInstance = axios.create({ baseURL: import.meta.env.VITE_API_URL, + withCredentials: true, headers: { - 'Content-Type': 'application/json', Accept: 'application/json', + 'Content-Type': 'application/json', }, timeout: 30000, }) -function getAccessToken(): string | null { - if (typeof document === 'undefined') return null - const cookies = parse(document.cookie) - const token = cookies.accessToken - - return token ?? null -} - apiClient.interceptors.request.use( (config: InternalAxiosRequestConfig) => { - const token = getAccessToken() - if (token) { - config.headers.Authorization = `Bearer ${token}` + const authStore = useAuthStore() + + if (authStore.token) { + config.headers.Authorization = `Bearer ${authStore.token}` } if (import.meta.env.DEV) { @@ -52,11 +46,14 @@ apiClient.interceptors.response.use( } if (error.response?.status === 401) { - document.cookie = 'accessToken=; path=/; max-age=0' - document.cookie = 'userData=; path=/; max-age=0' - document.cookie = 'userAbilityRules=; path=/; max-age=0' - if (window.location.pathname !== '/login') { - window.location.href = '/login' + const authStore = useAuthStore() + + if (authStore.isInitialized) { + authStore.logout() + + if (typeof window !== 'undefined' && window.location.pathname !== '/login') { + window.location.href = '/login' + } } } diff --git a/apps/portal/src/navigation/horizontal/index.ts b/apps/portal/src/navigation/horizontal/index.ts deleted file mode 100644 index f9dbf433..00000000 --- a/apps/portal/src/navigation/horizontal/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default [ - { - title: 'Home', - to: { name: 'root' }, - icon: { icon: 'tabler-smart-home' }, - }, - { - title: 'Second page', - to: { name: 'second-page' }, - icon: { icon: 'tabler-file' }, - }, -] diff --git a/apps/portal/src/navigation/vertical/index.ts b/apps/portal/src/navigation/vertical/index.ts deleted file mode 100644 index f9dbf433..00000000 --- a/apps/portal/src/navigation/vertical/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default [ - { - title: 'Home', - to: { name: 'root' }, - icon: { icon: 'tabler-smart-home' }, - }, - { - title: 'Second page', - to: { name: 'second-page' }, - icon: { icon: 'tabler-file' }, - }, -] diff --git a/apps/portal/src/pages/[...error].vue b/apps/portal/src/pages/[...error].vue deleted file mode 100644 index e5974455..00000000 --- a/apps/portal/src/pages/[...error].vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - diff --git a/apps/portal/src/pages/[...path].vue b/apps/portal/src/pages/[...path].vue new file mode 100644 index 00000000..6406635b --- /dev/null +++ b/apps/portal/src/pages/[...path].vue @@ -0,0 +1,36 @@ + + + diff --git a/apps/portal/src/pages/advance/[token].vue b/apps/portal/src/pages/advance/[token].vue new file mode 100644 index 00000000..32c7ccef --- /dev/null +++ b/apps/portal/src/pages/advance/[token].vue @@ -0,0 +1,35 @@ + + + diff --git a/apps/portal/src/pages/dashboard/index.vue b/apps/portal/src/pages/dashboard/index.vue new file mode 100644 index 00000000..4b7c2d84 --- /dev/null +++ b/apps/portal/src/pages/dashboard/index.vue @@ -0,0 +1,28 @@ + + + diff --git a/apps/portal/src/pages/index.vue b/apps/portal/src/pages/index.vue index b2731858..891817a5 100644 --- a/apps/portal/src/pages/index.vue +++ b/apps/portal/src/pages/index.vue @@ -1,25 +1,51 @@ -