Skip to content

Commit f623c8f

Browse files
committed
Some Fix
1 parent 9a24426 commit f623c8f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

GoogleApis.Blazor/Calendar/CalendarService.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public async Task<GoogleCalendarListRoot> GetCalendars(int maxResults = 250, boo
9090
string contentResult = await result.Content.ReadAsStringAsync();
9191
GoogleCalendarListRoot model = JsonSerializer.Deserialize<GoogleCalendarListRoot>(contentResult);
9292

93-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
93+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
9494
{
9595
return model;
9696
}
@@ -118,7 +118,7 @@ public async Task<GoogleCalendarListModel> GetCalendarById(string calendarId, bo
118118
string contentResult = await result.Content.ReadAsStringAsync();
119119
GoogleCalendarListModel model = JsonSerializer.Deserialize<GoogleCalendarListModel>(contentResult);
120120

121-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
121+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
122122
{
123123
return model;
124124
}
@@ -185,7 +185,7 @@ public async Task<GoogleCalendarModel> AddCalendar(GoogleCalendarListModel googl
185185
string contentResult = await result.Content.ReadAsStringAsync();
186186
GoogleCalendarModel model = JsonSerializer.Deserialize<GoogleCalendarModel>(contentResult);
187187

188-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
188+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
189189
{
190190
return model;
191191
}
@@ -220,7 +220,7 @@ public async Task<GoogleCalendarModel> UpdateCalendar(string calendarId, GoogleC
220220
string contentResult = await result.Content.ReadAsStringAsync();
221221
GoogleCalendarModel model = JsonSerializer.Deserialize<GoogleCalendarModel>(contentResult);
222222

223-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
223+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
224224
{
225225
return model;
226226
}
@@ -250,7 +250,7 @@ public async Task DeleteCalendar(string calendarId, bool forceAccessToken = fals
250250

251251
string contentResult = await result.Content.ReadAsStringAsync();
252252

253-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
253+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
254254
{
255255
return;
256256
}
@@ -281,7 +281,7 @@ public async Task ClearCalendar(string calendarId, bool forceAccessToken = false
281281

282282
string contentResult = await result.Content.ReadAsStringAsync();
283283

284-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
284+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
285285
{
286286
return;
287287
}
@@ -324,7 +324,7 @@ public async Task<GoogleCalendarEventRoot> GetEvents(DateTime timeMin, DateTime
324324
string contentResult = await result.Content.ReadAsStringAsync();
325325
GoogleCalendarEventRoot model = JsonSerializer.Deserialize<GoogleCalendarEventRoot>(contentResult);
326326

327-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
327+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
328328
{
329329
return model;
330330
}
@@ -353,7 +353,7 @@ public async Task<GoogleCalendarEventModel> GetEventById(string eventId, string
353353
string contentResult = await result.Content.ReadAsStringAsync();
354354
GoogleCalendarEventModel model = JsonSerializer.Deserialize<GoogleCalendarEventModel>(contentResult);
355355

356-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
356+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
357357
{
358358
return model;
359359
}
@@ -386,7 +386,7 @@ public async Task<string> AddEvent(GoogleCalendarEventModel calendarEvent, strin
386386

387387
string model = await result.Content.ReadAsStringAsync();
388388

389-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(model) || string.IsNullOrEmpty(RefreshToken))
389+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
390390
{
391391
return model;
392392
}
@@ -432,7 +432,7 @@ public async Task<string> UpdateEvent(GoogleCalendarEventModel newCalendarEvent,
432432

433433
string contentResult = await result.Content.ReadAsStringAsync();
434434

435-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
435+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
436436
{
437437
return contentResult;
438438
}
@@ -604,7 +604,7 @@ public async Task DeleteEvent(string eventId, string calendarId, bool forceAcces
604604

605605
string contentResult = await result.Content.ReadAsStringAsync();
606606

607-
if (forceAccessToken == false || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
607+
if (forceAccessToken == false || result.IsSuccessStatusCode || !AuthService.IsAccessTokenExpired(contentResult) || string.IsNullOrEmpty(RefreshToken))
608608
{
609609
return;
610610
}

0 commit comments

Comments
 (0)