diff --git a/resources/js/components/TwoFactorRecoveryCodes.vue b/resources/js/components/TwoFactorRecoveryCodes.vue index 684add3..2462639 100644 --- a/resources/js/components/TwoFactorRecoveryCodes.vue +++ b/resources/js/components/TwoFactorRecoveryCodes.vue @@ -12,7 +12,7 @@ import { CardTitle, } from '@/components/ui/card'; import { useTwoFactorAuth } from '@/composables/useTwoFactorAuth'; -import { regenerateRecoveryCodes } from '@/routes/two-factor'; +import { fortifyRoutes } from '@/lib/fortify'; const { recoveryCodesList, fetchRecoveryCodes, errors } = useTwoFactorAuth(); const isRecoveryCodesVisible = ref(false); @@ -64,7 +64,7 @@ onMounted(async () => {
; @@ -42,7 +42,7 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => { const fetchQrCode = async (): Promise => { try { const { svg } = await fetchJson<{ svg: string; url: string }>( - qrCode.url(), + fortifyRoutes.twoFactor.qrCode, ); qrCodeSvg.value = svg; @@ -55,7 +55,7 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => { const fetchSetupKey = async (): Promise => { try { const { secretKey: key } = await fetchJson<{ secretKey: string }>( - secretKey.url(), + fortifyRoutes.twoFactor.secretKey, ); manualSetupKey.value = key; @@ -85,7 +85,7 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => { try { clearErrors(); recoveryCodesList.value = await fetchJson( - recoveryCodes.url(), + fortifyRoutes.twoFactor.recoveryCodes, ); } catch { errors.value.push('Failed to fetch recovery codes'); diff --git a/resources/js/lib/fortify.ts b/resources/js/lib/fortify.ts new file mode 100644 index 0000000..d864177 --- /dev/null +++ b/resources/js/lib/fortify.ts @@ -0,0 +1,25 @@ +export const fortifyRoutes = { + register: { + create: '/register', + store: '/register', + }, + password: { + request: '/forgot-password', + email: '/forgot-password', + update: '/reset-password', + confirm: '/user/confirm-password', + reset: (token: string): string => `/reset-password/${encodeURIComponent(token)}`, + }, + verification: { + send: '/email/verification-notification', + }, + twoFactor: { + challenge: '/two-factor-challenge', + enable: '/user/two-factor-authentication', + disable: '/user/two-factor-authentication', + confirm: '/user/confirmed-two-factor-authentication', + qrCode: '/user/two-factor-qr-code', + recoveryCodes: '/user/two-factor-recovery-codes', + secretKey: '/user/two-factor-secret-key', + }, +} as const; diff --git a/resources/js/pages/Welcome.vue b/resources/js/pages/Welcome.vue index 474a491..2b276d0 100644 --- a/resources/js/pages/Welcome.vue +++ b/resources/js/pages/Welcome.vue @@ -1,6 +1,7 @@