fix sayings

This commit is contained in:
Peter Maquiran
2023-03-22 15:31:01 +01:00
parent 7c03c3f822
commit 6f99c792dc
35 changed files with 122 additions and 63 deletions
+21 -22
View File
@@ -11,6 +11,7 @@ import { catchError } from "rxjs/operators";
import { Storage } from '@ionic/storage';
import { BackgroundService } from 'src/app/services/background.service';
import { SessionStore } from '../store/session.service';
import { calendarInterface } from '../models/user.model';
@Injectable({
@@ -306,6 +307,22 @@ export class EventsService {
}
DetectCalendars(CalendarId) {
const calendars = SessionStore.user.OwnerCalendars.concat(SessionStore.user.SharedCalendars)
return calendars.find((e) => e.CalendarId == CalendarId)
}
makeHeader(calendar: calendarInterface) {
let header = new HttpHeaders();
header = header.set('Authorization', SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', calendar.CalendarId);
header = header.set('CalendarRoleId', calendar.CalendarRoleId);
header = header.set('CalendarName', calendar.CalendarName);
return header
}
isMyCalendar(CalendarId) {
return this.myCalendarNames[CalendarId] || ""
}
@@ -672,23 +689,14 @@ export class EventsService {
return this.http.get<Event>(`${geturl}`, options);
}
genericGetEvent(eventid: string, calendarId: string) {
let geturl = environment.apiURL + 'calendar/GetEvent';
let params = new HttpParams();
params = params.set("EventId", eventid);
const headers = [
this.headerSharedOficial,
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(calendarId)
})
const calendar = this.DetectCalendars(calendarId)
const header = this.makeHeader(calendar)
if(header) {
let options = {
@@ -867,17 +875,8 @@ export class EventsService {
let options: any;
const Selectedcalendar = SessionStore.user.OwnerCalendars.concat(SessionStore.user.SharedCalendars).find((calendar) =>{
return calendar.CalendarId == CalendarId
})
let header = new HttpHeaders();
header = header.set('Authorization',SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', Selectedcalendar.CalendarId);
header = header.set('CalendarRoleId', Selectedcalendar.CalendarRoleId);
// console.log(Selectedcalendar)
const calendar = this.DetectCalendars(CalendarId)
const header = this.makeHeader(calendar)
options = {
headers: header,