import UrlUtils from "~/services/utils/urlUtils";

export const useRedirectToLogout = () => {
    const runtimeConfig = useRuntimeConfig()

    return () => {
        if (!runtimeConfig.baseUrlAdminLegacy) {
            throw new Error('Configuration error : no redirection target')
        }
        navigateTo(UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, '#/logout'), {external: true})
    }
}
