Fix/office365 api call (#3534)
* WIP fixes for handling office365 api call * First working version microsoft api call handling * Remove logs * Clean up and improve function names * Clean up * Remove log * Fix function missing its correct name * Fix direct return of statement * Cleanup * Simplify with private fetcher * Update CalendarService.ts * Update getOfficeAppKeys.ts Co-authored-by: zomars <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
9 files changed
+271
-109
No files matched your search
@@ -11,6 +11,9 @@ export function getErrorFromUnknown(cause: unknown): Error & { statusCode?: numb
|
||||
}
|
||||
|
||||
export function handleErrorsJson(response: Response) {
|
||||
if (response.headers.get("content-encoding") === "gzip") {
|
||||
return response.text();
|
||||
}
|
||||
if (response.status === 204) {
|
||||
return new Promise((resolve) => resolve({}));
|
||||
}
|
||||
@@ -18,6 +21,7 @@ export function handleErrorsJson(response: Response) {
|
||||
response.json().then(console.log);
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user