only reset state on new quiz, then also remove link

This commit is contained in:
Oskar Winkels 2020-01-13 00:40:00 +01:00 committed by Oskar
parent 295e851868
commit e64f6ec709
1 changed files with 14 additions and 4 deletions

View File

@ -34,6 +34,17 @@ function showLink() {
}
function removeLink() {
var linkEl = document.getElementById('shareLink')
linkEl.href = ''
linkEl.innerHTML = ''
document.querySelector('#sharing input').style.display = 'block'
}
async function shareQuiz() {
if (state.id) {
@ -222,13 +233,14 @@ function createQuiz() {
console.log('Creating new quiz')
state = defaultState
removeLink()
if (parseSpreadsheet().success == false)
return
console.log('Spreadsheet parsing successful')
state.timer = 0
state.title = document.getElementById('titleField').value
updateTitles()
@ -251,8 +263,6 @@ function endQuiz() {
if (state.interval)
clearInterval(state.interval)
state = defaultState
console.log('Quiz ended')
}