useRedirectToLogin.ts 433 B

12345678910111213
  1. import {navigateTo, useRuntimeConfig} from "#app";
  2. import Url from "~/services/utils/url";
  3. export const useRedirectToLogin = () => {
  4. const runtimeConfig = useRuntimeConfig()
  5. return () => {
  6. if (!runtimeConfig.baseUrlAdminLegacy) {
  7. throw new Error('Configuration error : no redirection target')
  8. }
  9. navigateTo(Url.join(runtimeConfig.baseUrlAdminLegacy, '#/login'), {external: true})
  10. }
  11. }