Notifications page : mark all as read working
This commit is contained in:
parent
cdf663d4ca
commit
5c9f450539
7 changed files with 76 additions and 19 deletions
|
|
@ -5,6 +5,7 @@
|
|||
<button
|
||||
class="btn | absolute top-0 right-gutter"
|
||||
:disabled="!sortedNotifications.length"
|
||||
@click="readAll()"
|
||||
>
|
||||
Marquer tout come lu
|
||||
</button>
|
||||
|
|
@ -105,15 +106,16 @@
|
|||
import dayjs from "dayjs";
|
||||
import "dayjs/locale/fr";
|
||||
import Tabs from "../components/Tabs.vue";
|
||||
import { usePageStore } from "../stores/page";
|
||||
import { useUserStore } from "../stores/user";
|
||||
import { ref, computed } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useApiStore } from "../stores/api";
|
||||
|
||||
dayjs.locale("fr");
|
||||
|
||||
const { page } = storeToRefs(usePageStore());
|
||||
const userStore = useUserStore();
|
||||
const { notifications } = storeToRefs(useUserStore());
|
||||
const api = useApiStore();
|
||||
const currentTab = ref("all");
|
||||
const tabs = computed(() => {
|
||||
return [
|
||||
|
|
@ -161,6 +163,15 @@ function formatDate(notification) {
|
|||
return dayjs(notification.date).format("DD MMM YY");
|
||||
}
|
||||
}
|
||||
|
||||
function readAll() {
|
||||
try {
|
||||
api.readAllNotifications();
|
||||
userStore.readAllNotifications();
|
||||
} catch (error) {
|
||||
console.log("Could not read all notifications : ", error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue