cha
parent
6be7ee6f29
commit
c7fb298e4f
|
@ -40,6 +40,10 @@
|
||||||
</div>
|
</div>
|
||||||
<button :disabled="qPoint >= noOfQs + 2" @click="getNextQs(); selectOption(index);" class="bg-green-700 float-right p-1 sm:p-2.5 text-white font-bold rounded-lg active:bg-green-700/75"> Next Question</button>
|
<button :disabled="qPoint >= noOfQs + 2" @click="getNextQs(); selectOption(index);" class="bg-green-700 float-right p-1 sm:p-2.5 text-white font-bold rounded-lg active:bg-green-700/75"> Next Question</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="qPoint == noOfQs-1" class="flex flex-col place-items-center">
|
||||||
|
<p>Now you can submit your answer</p>
|
||||||
|
<button @click="submitAnswer" class="bg-[#FF0000] p-2.5 text-white font-bold rounded-lg">Final Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>No Data Found</div>
|
<div v-else>No Data Found</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,6 +98,25 @@ export default {
|
||||||
this.getNextQs();
|
this.getNextQs();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
submitAnswer(){
|
||||||
|
fetch(`https://api8.siliconpin.com/items/users_answers`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type' : 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ answers: this.totalAnswer })
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if(response.ok){
|
||||||
|
console.log('Data Saved Succesfully')
|
||||||
|
} else{
|
||||||
|
console.log('Something Wrong')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('an error occoured', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
getNextQs() {
|
getNextQs() {
|
||||||
this.qPoint++;
|
this.qPoint++;
|
||||||
this.qsActive=this.qsData[this.qPoint];
|
this.qsActive=this.qsData[this.qPoint];
|
||||||
|
|
Loading…
Reference in New Issue