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 | 66417650b46f27f8238cc6997e2ff14579c1244a (patch) | |
tree | 2ea398e3bc8189a8777c800fcf8a3845d604a652 /Timeline/ClientApp/src/app/http/common.ts | |
parent | 3d014eee30cf91c2e2c19af5c5140db137ccf225 (diff) | |
parent | ccebcc9a3704dc2056513042f717c321374c5350 (diff) | |
download | timeline-66417650b46f27f8238cc6997e2ff14579c1244a.tar.gz timeline-66417650b46f27f8238cc6997e2ff14579c1244a.tar.bz2 timeline-66417650b46f27f8238cc6997e2ff14579c1244a.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,
|