Есть такая ошибка
Avoided redundant navigation to current location: "/3".
Тут я пытаюсь сделать роут
next: async function (e) {
const data = new FormData(e.target);
// console.log(this.$router)
const response = await apiQuestion('POST', this.$route.params.step, data);
if (response.data.success){
await this.$router.push({name: 'step'}).catch(error =>{
console.error(error);
});
}
if(!response.data.success){
this.$toast.error(response.data.message);
}
}
Вот роутер
import {apiGetUser} from "../api/api.ts";
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const router = new VueRouter({
mode: 'history',
base: "quiz/",
routes: [
{
path: "/:step([1-9]{1}|[1-9]{2})",
name: "step",
component: () => import('../components/Question.vue'),
beforeEnter: async (to, from, next) => {
const user = await apiGetUser();
if (user.data.data.ended) {
return next({ name: 'finish' });
}
if (user.data.data.step !== to.params.step) {
return next({ name: 'step', params: {step: user.data.data.step} });
}
return next();
}
},
{
path: "/finish",
name: "finish",
component: () => import('../components/EndedQuiz.vue'),
beforeEnter: async (to, from, next) => {
const user = await apiGetUser();
if (!user.data.data.ended) {
return next({ name: 'step', params: {step: user.data.data.step} });
}
return next();
}
},
{
path: '*',
component: () => import('../components/NotFound.vue'),
}
],
});
export default router;