| 1234567891011121314151617181920212223242526272829 |
- import UrlUtils from '~/services/utils/urlUtils'
- export const useRedirect = () => {
- const runtimeConfig = useRuntimeConfig()
- const redirectToLogout = () => {
- const baseUrl = runtimeConfig.baseUrlAdminLegacy ?? runtimeConfig.public.baseUrlAdminLegacy
- if (!baseUrl) {
- throw new Error('Configuration error : no redirection target')
- }
- navigateTo(UrlUtils.join(baseUrl, '#/logout'), {
- external: true,
- })
- }
- const redirectToHome = () => {
- const baseUrl = runtimeConfig.baseUrlAdminLegacy ?? runtimeConfig.public.baseUrlAdminLegacy
- if (!baseUrl) {
- throw new Error('Configuration error : no redirection target')
- }
- navigateTo(UrlUtils.join(baseUrl, '#/dashboard'), {
- external: true,
- })
- }
- return { redirectToLogout, redirectToHome }
- }
|