| 123456789101112131415161718192021222324252627282930313233 |
- 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 }
- }
|