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

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 { } else {
try { try {
const pass = req.body.pass const pass = req.body.pass
if (pass.toLowerCase() === process.env.PASSWORD) { if (pass && pass.toLowerCase() === process.env.PASSWORD) {
req.session.loggedIn = true req.session.loggedIn = true
res.status(200).send("Logged in") res.status(200).send("Logged in")
} else { } else {

View File

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