I'm new to both JS and stackoverflow, so please let me know if I need to provide more detail, or if there is a better approach.
My goal is to have a modal (preferably the msgBoxConfirm modal) close, or "Cancel" programmatically after a set time period when no input is given. I've tried wrapping it in a setTimeout and calling a time out function from within .then, but failed in both attempts.
Here is a scaffold of the code I'd like to add a time out to:
timedModalAlert: function () {
this.$bvModal.msgBoxConfirm('Session expiration in XX. Press OK to continue.')
.then(value => {
if (value == true) {
// function to refresh token
} else {
// function to log user out
}
}
)
}
My attempt:
timedModalAlert: function () {
setTimeout (() => {
this.$bvModal.msgBoxConfirm('Session expiration in XX. Press OK to continue.')
.then(value => {
if (value == true) {
// function to refresh token
} else {
// function to log user out
}
}
)
}, 1000)