🩹 Избавился от ошибки сервера, когда пользователь не вводит пароль

This commit is contained in:
2021-03-28 19:52:04 +03:00
parent 8d0fe5788a
commit 59b0d588cb
2 changed files with 8 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ app.post('/auth', async (req, res) => {
} else {
try {
const pass = req.body.pass
if (pass.toLowerCase() === process.env.PASSWORD) {
if (pass && pass.toLowerCase() === process.env.PASSWORD) {
req.session.loggedIn = true
res.status(200).send("Logged in")
} else {

View File

@@ -13,6 +13,9 @@
</transition>
</div>
</div>
<div v-else>
Загрузка...
</div>
</template>
<script>
@@ -42,10 +45,13 @@ export default {
this.showResult = false
axios
.get(process.env.VUE_APP_BACKEND + '/card')
.then(response => (this.card = response.data))
.then(response => {
this.card = response.data
})
},
nextCard: function() {
if (this.showResult) {
this.card = null
this.getCard()
}
},