-
-
Notifications
You must be signed in to change notification settings - Fork 724
/
Calendar.vue
56 lines (54 loc) · 1.26 KB
/
Calendar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template lang="pug">
.cal-container
.cal
CalendarItem(v-for="item in calendar", :key="item.id", v-bind="item")
</template>
<script>
import CalendarItem from '@/components/CalendarItem';
import axios from 'axios';
import { CALENDAR_ID, CALENDAR_API } from '@/constants/calendar';
export default {
components: { CalendarItem },
data() {
return {
calendar: []
};
},
mounted: function() {
this.getCal();
},
methods: {
getCal() {
axios
.get(
`https://www.googleapis.com/calendar/v3/calendars/${encodeURI(
CALENDAR_ID
)}/events`,
{
params: {
maxItems: 100,
orderBy: 'startTime',
singleEvents: true,
timeMin: new Date(new Date().setHours(0, 0, 0, 0)).toISOString(),
key: CALENDAR_API
}
}
)
.then(({ data }) => {
this.calendar = data.items.filter(
item =>
item.summary &&
item.summary !== 'Westside Hack Night' &&
item.summary !== 'DTLA Hack Night'
);
});
},
showInfo(item) {
item.showMore = true;
},
closeInfo(item) {
item.showMore = false;
}
}
};
</script>