Skip to content

Commit

Permalink
Use route helper in two factor authentication form (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
sushantaryal authored Mar 1, 2023
1 parent 11109e0 commit 2af8f16
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ watch(twoFactorEnabled, () => {
const enableTwoFactorAuthentication = () => {
enabling.value = true;
router.post('/user/two-factor-authentication', {}, {
router.post(route('two-factor.enable'), {}, {
preserveScroll: true,
onSuccess: () => Promise.all([
showQrCode(),
Expand All @@ -54,25 +54,25 @@ const enableTwoFactorAuthentication = () => {
};
const showQrCode = () => {
return axios.get('/user/two-factor-qr-code').then(response => {
return axios.get(route('two-factor.qr-code')).then(response => {
qrCode.value = response.data.svg;
});
};
const showSetupKey = () => {
return axios.get('/user/two-factor-secret-key').then(response => {
return axios.get(route('two-factor.secret-key')).then(response => {
setupKey.value = response.data.secretKey;
});
}
const showRecoveryCodes = () => {
return axios.get('/user/two-factor-recovery-codes').then(response => {
return axios.get(route('two-factor.recovery-codes')).then(response => {
recoveryCodes.value = response.data;
});
};
const confirmTwoFactorAuthentication = () => {
confirmationForm.post('/user/confirmed-two-factor-authentication', {
confirmationForm.post(route('two-factor.confirm'), {
errorBag: "confirmTwoFactorAuthentication",
preserveScroll: true,
preserveState: true,
Expand All @@ -86,14 +86,14 @@ const confirmTwoFactorAuthentication = () => {
const regenerateRecoveryCodes = () => {
axios
.post('/user/two-factor-recovery-codes')
.post(route('two-factor.recovery-codes'))
.then(() => showRecoveryCodes());
};
const disableTwoFactorAuthentication = () => {
disabling.value = true;
router.delete('/user/two-factor-authentication', {
router.delete(route('two-factor.disable'), {
preserveScroll: true,
onSuccess: () => {
disabling.value = false;
Expand Down

0 comments on commit 2af8f16

Please sign in to comment.