mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 23:51:25 +00:00
Archie filtering is reactive
This commit is contained in:
@@ -1,21 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<h1>VMail Inbox</h1>
|
<h1>VMail Inbox</h1>
|
||||||
|
|
||||||
<BulkActionBar :emails="emails" />
|
<BulkActionBar :emails="inboxEmails" />
|
||||||
|
|
||||||
<MailTable :emails="emails.filter(e => !e.archived)" />
|
<MailTable :emails="inboxEmails" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MailTable from '@/components/MailTable.vue';
|
import MailTable from '@/components/MailTable.vue';
|
||||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||||
|
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async setup(props, {attrs, slots}){
|
async setup(props, {attrs, slots}){
|
||||||
let response = await fetch('/api/emails');
|
let response = await fetch('/api/emails');
|
||||||
let {emails} = await response.json();
|
let {emails} = await response.json();
|
||||||
|
|
||||||
return {emails}
|
emails = ref(emails);
|
||||||
|
let inboxEmails = computed(() => {
|
||||||
|
return emails.value.filter(e => !e.archived)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {inboxEmails}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
MailTable,
|
MailTable,
|
||||||
|
|||||||
Reference in New Issue
Block a user