[store] Rename to EventStore
This commit is contained in:
parent
661685c57a
commit
8b6fd67f1d
|
@ -102,7 +102,7 @@
|
|||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, ref, onBeforeMount } from 'vue';
|
||||
import { date, ModifyDateOptions } from 'quasar';
|
||||
import { useScheduleStore } from '../../store';
|
||||
import { useEventStore } from '../../store';
|
||||
import { notEmpty } from '@flaschengeist/api';
|
||||
import { IsoDateInput } from '@flaschengeist/api/components';
|
||||
import EditJobSlot from './EditJobSlot.vue';
|
||||
|
@ -127,7 +127,7 @@ export default defineComponent({
|
|||
done: (val: boolean) => typeof val === 'boolean',
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
const startDate = computed(() => {
|
||||
const d = date.buildDate({milliseconds: 0, seconds: 0, minutes: 0, hours: 0})
|
||||
if (!props.date || !date.isValid(props.date)) return d
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
import { defineComponent, computed, onBeforeMount, PropType } from 'vue';
|
||||
import { IsoDateInput } from '@flaschengeist/api/components';
|
||||
import { notEmpty } from '@flaschengeist/api';
|
||||
import { useScheduleStore } from '../../store';
|
||||
import { useEventStore } from '../../store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'JobSlot',
|
||||
|
@ -73,7 +73,7 @@ export default defineComponent({
|
|||
'update:modelValue': (job: FG.Job) => !!job,
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
|
||||
onBeforeMount(() => store.getJobTypes());
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
<script lang="ts">
|
||||
import { isAxiosError } from '@flaschengeist/api';
|
||||
import { defineComponent, ref, computed, PropType, onBeforeMount } from 'vue';
|
||||
import { useScheduleStore } from '../../store';
|
||||
import { Notify, QInput } from 'quasar';
|
||||
import { useEventStore } from '../../store';
|
||||
import { useQuasar, QInput } from 'quasar';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ManageTypes',
|
||||
|
@ -61,7 +61,9 @@ export default defineComponent({
|
|||
title: {type: String, required: true}
|
||||
},
|
||||
setup(props) {
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const dialogOpen = ref(false);
|
||||
const emptyType = { id: -1, name: '' };
|
||||
const actualType = ref(emptyType);
|
||||
|
@ -105,12 +107,12 @@ export default defineComponent({
|
|||
})
|
||||
.catch((e) => {
|
||||
if (isAxiosError(e, 409))
|
||||
Notify.create({
|
||||
quasar.notify({
|
||||
type: 'negative',
|
||||
message: 'Der Name wird bereits verwendet',
|
||||
});
|
||||
else
|
||||
Notify.create({
|
||||
quasar.notify({
|
||||
type: 'negative',
|
||||
message: 'Unbekannter Fehler beim speichern.',
|
||||
});
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { ComponentPublicInstance, computed, defineComponent, onBeforeMount, ref } from 'vue';
|
||||
import { useScheduleStore } from '../../store';
|
||||
import { useEventStore } from '../../store';
|
||||
import EventSlot from './slots/EventSlot.vue';
|
||||
import { date, useQuasar } from 'quasar';
|
||||
import { startOfWeek } from '@flaschengeist/api';
|
||||
|
@ -111,7 +111,7 @@ export default defineComponent({
|
|||
components: { EventSlot, EditEvent, QCalendarAgenda: <ComponentPublicInstance>QCalendarAgenda },
|
||||
|
||||
setup() {
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const selectedDate = ref(date.formatDate(new Date(), 'YYYY-MM-DD'));
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, onBeforeMount, ref } from 'vue';
|
||||
import { useScheduleStore } from '../../store';
|
||||
import { date, scroll } from 'quasar';
|
||||
import { useEventStore } from '../../store';
|
||||
import { date } from 'quasar';
|
||||
import EditEvent from '../management/EditEvent.vue';
|
||||
import EventSlot from '../overview/slots/EventSlot.vue';
|
||||
|
||||
|
@ -59,7 +59,7 @@ export default defineComponent({
|
|||
[index: string]: FG.Event[];
|
||||
}
|
||||
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
|
||||
const editor = ref<FG.Event | undefined>(undefined);
|
||||
const events = ref<FG.Event[]>([]);
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onBeforeMount, computed, PropType } from 'vue';
|
||||
import { Notify } from 'quasar';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { asHour, useMainStore, useUserStore } from '@flaschengeist/api';
|
||||
import { useScheduleStore } from '../../../store';
|
||||
import { useEventStore } from '../../../store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'JobSlot',
|
||||
|
@ -54,10 +54,10 @@ export default defineComponent({
|
|||
},
|
||||
emits: { 'update:modelValue': (v: FG.Job) => !!v },
|
||||
setup(props, { emit }) {
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
const mainStore = useMainStore();
|
||||
const userStore = useUserStore();
|
||||
const availableUsers = null;
|
||||
const quasar = useQuasar();
|
||||
|
||||
onBeforeMount(async () => userStore.getUsers());
|
||||
|
||||
|
@ -90,7 +90,7 @@ export default defineComponent({
|
|||
emit('update:modelValue', job);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
Notify.create({
|
||||
quasar.notify({
|
||||
group: false,
|
||||
type: 'negative',
|
||||
message: 'Fehler beim Eintragen als Dienst',
|
||||
|
@ -113,7 +113,7 @@ export default defineComponent({
|
|||
emit('update:modelValue', job);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
Notify.create({
|
||||
quasar.notify({
|
||||
group: false,
|
||||
type: 'negative',
|
||||
message: 'Fehler beim Austragen als Dienst',
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
<script lang="ts">
|
||||
import { onBeforeMount, defineComponent, ref } from 'vue';
|
||||
import EditEvent from '../components/management/EditEvent.vue';
|
||||
import { useScheduleStore } from '../store';
|
||||
import { useEventStore } from '../store';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default defineComponent({
|
||||
components: { EditEvent },
|
||||
setup() {
|
||||
const route = useRoute();
|
||||
const store = useScheduleStore();
|
||||
const store = useEventStore();
|
||||
const event = ref<FG.Event | undefined>(undefined);
|
||||
onBeforeMount(async () => {
|
||||
if ('id' in route.params && typeof route.params.id === 'string')
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { api, isAxiosError } from '@flaschengeist/api';
|
||||
import { AxiosError } from 'axios';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
interface UserService {
|
||||
|
@ -18,7 +17,7 @@ function fixEvent(event: FG.Event) {
|
|||
event.jobs.forEach((job) => fixJob(job));
|
||||
}
|
||||
|
||||
export const useScheduleStore = defineStore({
|
||||
export const useEventStore = defineStore({
|
||||
id: 'events',
|
||||
|
||||
state: () => ({
|
||||
|
@ -89,8 +88,7 @@ export const useScheduleStore = defineStore({
|
|||
const idx = this.templates.findIndex((v) => v.id === id);
|
||||
if (idx !== -1) this.templates.splice(idx, 1);
|
||||
} catch (e) {
|
||||
const error = <AxiosError>e;
|
||||
if (error.response && error.response.status === 404) return false;
|
||||
if (isAxiosError(e, 404)) return false
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue