resolve first batch of comments

This commit is contained in:
Adrian Thompson
2020-09-07 13:15:10 +02:00
parent ed6ac2ac01
commit 6d26da1817
4 changed files with 10 additions and 11 deletions

1
.gitignore vendored
View File

@@ -4,7 +4,6 @@ public/index.html
public/sw/
config/env/lottery.config.js
config/env/push.config.js
config/env/vinmonopolet.config.js
# Logs
logs

View File

@@ -9,7 +9,6 @@ mongoose.connect("mongodb://localhost:27017/vinlottis", {
const Purchase = require(path.join(__dirname + "/../schemas/Purchase"));
const Wine = require(path.join(__dirname + "/../schemas/Wine"));
const Highscore = require(path.join(__dirname + "/../schemas/Highscore"));
const RequestedWine = require(path.join(__dirname + "/../schemas/RequestedWine"));
const PreLotteryWine = require(path.join(
__dirname + "/../schemas/PreLotteryWine"
));

View File

@@ -4,8 +4,8 @@
Alle foreslåtte viner
</h1>
<section class="requested-wines-container">
<p v-if="this.wines == undefined || this.wines.length <= 0">Ingen har foreslått noe enda!</p>
<RequestedWineCard v-for="requestedEl in wines" :key="requestedEl.id" :requestedElement="requestedEl" @deletedOne="refreshData" />
<p v-if="wines == undefined || wines.length == 0">Ingen har foreslått noe enda!</p>
<RequestedWineCard v-for="requestedEl in wines" :key="requestedEl.id" :requestedElement="requestedEl" @wineDeleted="filterOutDeletedWine" />
</section>
</main>
</template>
@@ -24,10 +24,11 @@ export default {
}
},
methods: {
filterOutDeletedWine(wine){
this.wines = this.wines.filter(item => item.wine._id !== wine._id)
},
async refreshData(){
this.wines = []
const wines = await allRequestedWines()
this.wines = wines
this.wines = await allRequestedWines() || []
}
},
mounted() {

View File

@@ -19,9 +19,9 @@
class="wine-link"
>Les mer polet</a>
</section>
<!-- <button @click="deleteWine(wine)">
<button @click="deleteWine(wine)">
Slett vinen
</button> -->
</button>
</section>
</div>
</template>
@@ -63,9 +63,9 @@ export default {
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
let response = await deleteRequestedWine(wine);
if (response) {
this.$emit('deletedOne');
this.$emit('wineDeleted', wine);
} else {
alert("Klarte ikke hente ut vinnere");
alert("Klarte ikke slette vinen");
}
}
},