MOBILE-3978 calendar: Add fallback for access info
parent
e7b8a824c2
commit
fc0d2b1307
|
@ -160,14 +160,20 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
|
||||||
* @return Promise resolved when done.
|
* @return Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
protected async fetchData(): Promise<void> {
|
protected async fetchData(): Promise<void> {
|
||||||
let accessInfo: AddonCalendarGetCalendarAccessInformationWSResponse;
|
|
||||||
|
|
||||||
this.error = false;
|
this.error = false;
|
||||||
|
|
||||||
// Get access info.
|
// Get access info.
|
||||||
try {
|
try {
|
||||||
accessInfo = await AddonCalendar.getAccessInformation(this.courseId);
|
const [types, accessInfo] = await Promise.all([
|
||||||
this.types = await AddonCalendar.getAllowedEventTypes(this.courseId);
|
AddonCalendar.getAllowedEventTypes(this.courseId),
|
||||||
|
CoreUtils.ignoreErrors(AddonCalendar.getAccessInformation(this.courseId), {
|
||||||
|
canmanageentries: false,
|
||||||
|
canmanageownentries: false,
|
||||||
|
canmanagegroupentries: false,
|
||||||
|
} as AddonCalendarGetCalendarAccessInformationWSResponse),
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.types = types;
|
||||||
|
|
||||||
const promises: Promise<void>[] = [];
|
const promises: Promise<void>[] = [];
|
||||||
const eventTypes = AddonCalendarHelper.getEventTypeOptions(this.types);
|
const eventTypes = AddonCalendarHelper.getEventTypeOptions(this.types);
|
||||||
|
|
Loading…
Reference in New Issue