resolve first batch of comments
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,7 +4,6 @@ public/index.html
|
|||||||
public/sw/
|
public/sw/
|
||||||
config/env/lottery.config.js
|
config/env/lottery.config.js
|
||||||
config/env/push.config.js
|
config/env/push.config.js
|
||||||
config/env/vinmonopolet.config.js
|
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ mongoose.connect("mongodb://localhost:27017/vinlottis", {
|
|||||||
const Purchase = require(path.join(__dirname + "/../schemas/Purchase"));
|
const Purchase = require(path.join(__dirname + "/../schemas/Purchase"));
|
||||||
const Wine = require(path.join(__dirname + "/../schemas/Wine"));
|
const Wine = require(path.join(__dirname + "/../schemas/Wine"));
|
||||||
const Highscore = require(path.join(__dirname + "/../schemas/Highscore"));
|
const Highscore = require(path.join(__dirname + "/../schemas/Highscore"));
|
||||||
const RequestedWine = require(path.join(__dirname + "/../schemas/RequestedWine"));
|
|
||||||
const PreLotteryWine = require(path.join(
|
const PreLotteryWine = require(path.join(
|
||||||
__dirname + "/../schemas/PreLotteryWine"
|
__dirname + "/../schemas/PreLotteryWine"
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
Alle foreslåtte viner
|
Alle foreslåtte viner
|
||||||
</h1>
|
</h1>
|
||||||
<section class="requested-wines-container">
|
<section class="requested-wines-container">
|
||||||
<p v-if="this.wines == undefined || this.wines.length <= 0">Ingen har foreslått noe enda!</p>
|
<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" @deletedOne="refreshData" />
|
<RequestedWineCard v-for="requestedEl in wines" :key="requestedEl.id" :requestedElement="requestedEl" @wineDeleted="filterOutDeletedWine" />
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
@@ -24,10 +24,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
filterOutDeletedWine(wine){
|
||||||
|
this.wines = this.wines.filter(item => item.wine._id !== wine._id)
|
||||||
|
},
|
||||||
async refreshData(){
|
async refreshData(){
|
||||||
this.wines = []
|
this.wines = await allRequestedWines() || []
|
||||||
const wines = await allRequestedWines()
|
|
||||||
this.wines = wines
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
class="wine-link"
|
class="wine-link"
|
||||||
>Les mer på polet</a>
|
>Les mer på polet</a>
|
||||||
</section>
|
</section>
|
||||||
<!-- <button @click="deleteWine(wine)">
|
<button @click="deleteWine(wine)">
|
||||||
Slett vinen
|
Slett vinen
|
||||||
</button> -->
|
</button>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -63,9 +63,9 @@ export default {
|
|||||||
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
|
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
|
||||||
let response = await deleteRequestedWine(wine);
|
let response = await deleteRequestedWine(wine);
|
||||||
if (response) {
|
if (response) {
|
||||||
this.$emit('deletedOne');
|
this.$emit('wineDeleted', wine);
|
||||||
} else {
|
} else {
|
||||||
alert("Klarte ikke hente ut vinnere");
|
alert("Klarte ikke slette vinen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user