This commit is contained in:
Julian Krauser 2024-11-24 15:31:08 +01:00
parent 03710dfdae
commit 9a1ff79f66
43 changed files with 264 additions and 92 deletions

View file

@ -30,7 +30,7 @@ export const useCalendarStore = defineStore("calendar", {
fetchCalendars() {
this.loading = "loading";
http
.get("/admin/calendar/items")
.get("/admin/calendar")
.then((result) => {
this.calendars = result.data;
this.loading = "fetched";
@ -40,10 +40,10 @@ export const useCalendarStore = defineStore("calendar", {
});
},
fetchCalendarById(id: string): Promise<AxiosResponse<any, any>> {
return http.get(`/admin/calendar/item/${id}`);
return http.get(`/admin/calendar/${id}`);
},
async createCalendar(calendar: CreateCalendarViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/calendar/item`, {
const result = await http.post(`/admin/calendar`, {
starttime: calendar.starttime,
endtime: calendar.endtime,
title: calendar.title,
@ -56,7 +56,7 @@ export const useCalendarStore = defineStore("calendar", {
return result;
},
async updateCalendar(calendar: UpdateCalendarViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/calendar/item/${calendar.id}`, {
const result = await http.patch(`/admin/calendar/${calendar.id}`, {
starttime: calendar.starttime,
endtime: calendar.endtime,
title: calendar.title,
@ -69,7 +69,7 @@ export const useCalendarStore = defineStore("calendar", {
return result;
},
async deleteCalendar(calendar: number): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/calendar/item/${calendar}`);
const result = await http.delete(`/admin/calendar/${calendar}`);
this.fetchCalendars();
return result;
},

View file

@ -19,7 +19,7 @@ export const useCalendarTypeStore = defineStore("calendarType", {
fetchCalendarTypes() {
this.loading = "loading";
http
.get("/admin/calendar/types")
.get("/admin/calendartype")
.then((result) => {
this.calendarTypes = result.data;
this.loading = "fetched";
@ -29,10 +29,10 @@ export const useCalendarTypeStore = defineStore("calendarType", {
});
},
fetchCalendarTypeById(id: number): Promise<AxiosResponse<any, any>> {
return http.get(`/admin/calendar/type/${id}`);
return http.get(`/admin/calendartype/${id}`);
},
async createCalendarType(calendarType: CreateCalendarTypeViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/calendar/type`, {
const result = await http.post(`/admin/calendartype`, {
type: calendarType.type,
nscdr: calendarType.nscdr,
color: calendarType.color,
@ -41,7 +41,7 @@ export const useCalendarTypeStore = defineStore("calendarType", {
return result;
},
async updateActiveCalendarType(calendarType: UpdateCalendarTypeViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/calendar/type/${calendarType.id}`, {
const result = await http.patch(`/admin/calendartype/${calendarType.id}`, {
type: calendarType.type,
nscdr: calendarType.nscdr,
color: calendarType.color,
@ -50,7 +50,7 @@ export const useCalendarTypeStore = defineStore("calendarType", {
return result;
},
async deleteCalendarType(calendarType: number): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/calendar/type/${calendarType}`);
const result = await http.delete(`/admin/calendartype/${calendarType}`);
this.fetchCalendarTypes();
return result;
},

View file

@ -1,5 +1,5 @@
import { defineStore } from "pinia";
import type { InviteViewModel } from "@/viewmodels/admin/invite.models";
import type { CreateInviteViewModel, InviteViewModel } from "@/viewmodels/admin/invite.models";
import { http } from "@/serverCom";
import type { PermissionObject } from "@/types/permissionTypes";
import type { AxiosResponse } from "axios";
@ -24,11 +24,18 @@ export const useInviteStore = defineStore("invite", {
this.loading = "failed";
});
},
deleteInvite(mail: string): Promise<AxiosResponse<any, any>> {
return http.delete(`/admin/invite/${mail}`).then((result) => {
this.fetchInvites();
return result;
createInvite(createInvite: CreateInviteViewModel): Promise<AxiosResponse<any, any>> {
return http.post(`/admin/invite`, {
username: createInvite.username,
mail: createInvite.mail,
firstname: createInvite.firstname,
lastname: createInvite.lastname,
});
},
async deleteInvite(mail: string): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/invite/${mail}`);
this.fetchInvites();
return result;
},
},
});