diff options
author | crupest <crupest@outlook.com> | 2020-08-03 02:24:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 02:24:48 +0800 |
commit | f84fc5e653d6d29add893b6d2573d04c91fd1d40 (patch) | |
tree | 794fc1c3e4c4791e091d785db0f45ae12c774677 /Timeline/ClientApp/src/app/http/common.ts | |
parent | fe950cad28ec6ff7bf6f399ddd31448180bc7601 (diff) | |
parent | 0a456da9e9cc0cf0244e80a3da5af26debd20841 (diff) | |
download | timeline-f84fc5e653d6d29add893b6d2573d04c91fd1d40.tar.gz timeline-f84fc5e653d6d29add893b6d2573d04c91fd1d40.tar.bz2 timeline-f84fc5e653d6d29add893b6d2573d04c91fd1d40.zip |
Merge pull request #130 from crupest/offline-timeline
Save timeline locally.
Diffstat (limited to 'Timeline/ClientApp/src/app/http/common.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/http/common.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/http/common.ts b/Timeline/ClientApp/src/app/http/common.ts index 8fb8eb69..3c2f2ba6 100644 --- a/Timeline/ClientApp/src/app/http/common.ts +++ b/Timeline/ClientApp/src/app/http/common.ts @@ -119,6 +119,16 @@ export function convertToNetworkError( }
}
+export function extractDataOrConvert304ToNotModified<T>(
+ res: AxiosResponse<T>
+): T | NotModified {
+ if (res.status === 304) {
+ return new NotModified();
+ } else {
+ return res.data;
+ }
+}
+
export function convertToBlobWithEtag(res: AxiosResponse<Blob>): BlobWithEtag {
return {
data: res.data,
|