Categories
javascript vue-router vue.js vuejs2

Is it Possible to lock all routes except one, in vue-router ? Is it secure? Or maybe I should use another method?

I want to build an online exam, this exam has 5 pages, there is a count down timer (120 seconds) and 4 questions on each page. After 120 seconds users are automatically transferred to the next page, or they can click on next button before that.

Laravel5.4 and VueJs, There is an Ajax request for every question that user answers. What I want is preventing the user from seeing other pages. Each page has to be visible for maximum 120 seconds. The user should not be able to click on back button and see previous pages. Is this possible at all?

I want to create this app with Vuejs and vue-router but I don’t know how to implement this with vue-router, I have done some research but got not much result!

Or maybe I should not use vue-router, and use my own simple router, for example :

$("#page1").show();
$("#page2").hide();
$("#page3").hide();
.
.
// after 120 secs
$("#page1").hide();
$("#page2").show();
$("#page3").hide();
.
.
// i think this is not secure !

Any thoughts are appreciated. Thank you.

UPDATE:
In this exam, user can see a list of English words randomly selected from words table and nothing else! The user clicks on every word he thinks he knows its meaning! And an ajax request for every click to save the id of the word in results table. Also, There is a fake_words table that is 50 words randomly is selected in addition to actual words if the user clicks on fake words more than 3 times, the test will fail. The final result will tell the user how much vocabulary skill he has.

UPDATE 2: I tried to do this with vue-router, but before starting to code, I thought maybe it should not be implemented with vue-router because all questions randomly get from DB in one query, then before exam starts, all of them are send (ajax) to the browser, now what should I do? Slice them in separate arrays and send each array of questions to one of my pages? do I have to do that? can not I use only one v-for for them? what if I decide to change number of questions? Then I think I have to touch my code every time and create new page for vue-router or remove one of pages.