Revisão: Autenticação, Page Events, Page Expediente.

This commit is contained in:
Paulo Pinto
2020-08-21 00:22:51 +01:00
parent 65c4cabcbf
commit c046fd92c0
20 changed files with 268 additions and 192 deletions
+25 -9
View File
@@ -4,8 +4,11 @@ import { Event } from '../models/event.model';
import axios from 'axios'
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { stringify } from 'querystring';
import { AuthService } from '../services/auth.service';
import { User } from '../models/user.model';
import { CalModalPageRoutingModule } from '../pages/cal-modal/cal-modal-routing.module';
@Injectable({
providedIn: 'root'
@@ -56,18 +59,31 @@ export class EventsService {
Attachments: null,
}
];
options = {};
loggeduser: User;
url = 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/api/calendar/GetEvents?StartDate=2020-08-14 00:00:00&EndDate=2020-08-19 23:59:00&CalendarName=Pessoal';
options = { headers: {'Authorization': 'Basic cGF1bG8ucGludG86dGFidGVzdGVAMDA2'}};
constructor(private http: HttpClient) { }
constructor(private http: HttpClient, private user: AuthService) {
this.loggeduser = user.ValidatedUser;
this.options = { headers: {'Authorization': this.loggeduser.BasicAuthKey}};
}
allEvents(): Observable<Event[]>{
return this.http.get<Event[]>(`${this.url}`, this.options)
console.log(this.loggeduser);
const geturl = environment.apiURL + 'calendar/GetEvents?StartDate=2020-08-14 00:00:00&EndDate=2020-08-19 23:59:00&CalendarName=Pessoal';
return this.http.get<Event[]>(`${geturl}`, this.options)
}
getEvent(ev: string): Observable<Event>{
const url = 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/api/calendar/GetEvent?EventId=';
return this.http.get<Event>(`${url + ev}`, this.options)
const geturl = environment.apiURL + 'calendar/GetEvent?EventId=';
return this.http.get<Event>(`${geturl + ev}`, this.options)
}
PutEvent(event: Event): Observable<Event>
{
const puturl = environment.apiURL +'calendar/PutEvent?conflictResolutionMode=2&sendInvitationsOrCancellationsMode=3';
return this.http.put<Event>(`${puturl}`, event,this.options)
}
AddEvent(postEvent: any){