appointments.js
5 days ago
attendees.js
5 days ago
colorManipulation.js
5 days ago
customer.js
5 days ago
date.js
5 days ago
defaultCustomize.js
5 days ago
employee.js
5 days ago
events.js
5 days ago
formFieldsTemplates.js
5 days ago
formatting.js
5 days ago
helper.js
5 days ago
image.js
5 days ago
integrationApple.js
5 days ago
integrationGoogle.js
5 days ago
integrationOutlook.js
5 days ago
integrationStripe.js
5 days ago
integrationZoom.js
5 days ago
licence.js
5 days ago
phone.js
5 days ago
pricing.js
5 days ago
recurring.js
5 days ago
responsive.js
5 days ago
scrollElements.js
5 days ago
settings.js
5 days ago
translationsElementPlus.js
5 days ago
utilHeaderHeight.js
5 days ago
integrationApple.js
38 lines
| 1 | import httpClient from '../../../plugins/axios' |
| 2 | import { ref } from 'vue' |
| 3 | |
| 4 | let isEmployeeConnectedToPersonalAppleCalendar = ref(false) |
| 5 | |
| 6 | function useAppleSync(store) { |
| 7 | store.commit('auth/setAppleLoading', true) |
| 8 | |
| 9 | httpClient |
| 10 | .get('/apple/calendar-list/' + store.getters['employee/getId']) |
| 11 | .then((response) => { |
| 12 | store.commit( |
| 13 | 'auth/setAppleCalendars', |
| 14 | response.data.data?.calendarList ? response.data.data.calendarList : [], |
| 15 | ) |
| 16 | |
| 17 | if ( |
| 18 | store.getters['auth/getAppleCalendars'] |
| 19 | .map((i) => i.id) |
| 20 | .indexOf(store.getters['employee/getAppleCalendarId']) === -1 |
| 21 | ) { |
| 22 | store.commit('employee/setAppleCalendarId', '') |
| 23 | } |
| 24 | store.commit('employee/setAppleCalendarId', response.data.data?.appleCalendarId) |
| 25 | |
| 26 | isEmployeeConnectedToPersonalAppleCalendar.value = |
| 27 | response.data.data.isEmployeeConnectedToPersonalAppleCalendar |
| 28 | }) |
| 29 | .catch((error) => { |
| 30 | console.log(error) |
| 31 | }) |
| 32 | .finally(() => { |
| 33 | store.commit('auth/setAppleLoading', false) |
| 34 | }) |
| 35 | } |
| 36 | |
| 37 | export { isEmployeeConnectedToPersonalAppleCalendar, useAppleSync } |
| 38 |