Skip to content

Commit

Permalink
Progress on calendars store migration
Browse files Browse the repository at this point in the history
Signed-off-by: Grigory V <[email protected]>
  • Loading branch information
GVodyanov committed Jan 31, 2024
1 parent a84e0d7 commit d856096
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 316 deletions.
14 changes: 8 additions & 6 deletions src/components/AppNavigation/CalendarList/CalendarListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import Pencil from 'vue-material-design-icons/Pencil.vue'
import Undo from 'vue-material-design-icons/Undo.vue'
import LinkVariant from 'vue-material-design-icons/LinkVariant.vue'
import usePrincipalsStore from '../../../store/principals.js'
import useCalendarsStore from '../../../store/calendars.js'

Check failure on line 109 in src/components/AppNavigation/CalendarList/CalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check failure on line 109 in src/components/AppNavigation/CalendarList/CalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check warning on line 109 in src/components/AppNavigation/CalendarList/CalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check warning on line 109 in src/components/AppNavigation/CalendarList/CalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)
import { mapStores } from 'pinia'

export default {
Expand Down Expand Up @@ -135,7 +136,7 @@ export default {
}
},
computed: {
...mapStores(usePrincipalsStore()),
...mapStores(usePrincipalsStore, useCalendarsStore),
/**
* Whether to show the sharing section
*
Expand Down Expand Up @@ -222,11 +223,12 @@ export default {
* Toggles the enabled state of this calendar
*/
toggleEnabled() {
this.$store.dispatch('toggleCalendarEnabled', { calendar: this.calendar })
.catch((error) => {
showError(this.$t('calendar', 'An error occurred, unable to change visibility of the calendar.'))
console.error(error)
})
try {
this.calendarsStore.calendarsById[this.calendar.id].enabled = !this.calendarsStore.calendarsById[this.calendar.id].enabled
} catch (error) {
showError(this.$t('calendar', 'An error occurred, unable to change visibility of the calendar.'))
console.error(error)
}
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ import {

import Download from 'vue-material-design-icons/Download.vue'
import LinkVariant from 'vue-material-design-icons/LinkVariant.vue'
import useCalendarsStore from '../../../store/calendars.js'
import { mapStores } from 'pinia'

Check failure on line 96 in src/components/AppNavigation/CalendarList/PublicCalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check failure on line 96 in src/components/AppNavigation/CalendarList/PublicCalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check warning on line 96 in src/components/AppNavigation/CalendarList/PublicCalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

Check warning on line 96 in src/components/AppNavigation/CalendarList/PublicCalendarListItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Parse errors in imported module '../../../store/calendars.js': Unexpected token, expected "{" (60:7) (60:7)

export default {
name: 'PublicCalendarListItem',
Expand Down Expand Up @@ -123,6 +125,7 @@ export default {
}
},
computed: {
...mapStores(useCalendarsStore),
/**
* Download url of the calendar
*
Expand Down Expand Up @@ -193,9 +196,7 @@ export default {
}
},
toggleEnabled() {
this.$store.commit('toggleCalendarEnabled', {
calendar: this.calendar,
})
this.calendarsStore.calendarsById[this.calendar.id].enabled = !this.calendarsStore.calendarsById[this.calendar.id].enabled
},
},
}
Expand Down
Loading

0 comments on commit d856096

Please sign in to comment.