]> Untitled Git - lemmy.git/commitdiff
Check for pictshare status ok.
authorDessalines <tyhou13@gmx.com>
Thu, 27 Feb 2020 19:06:29 +0000 (14:06 -0500)
committerDessalines <tyhou13@gmx.com>
Thu, 27 Feb 2020 19:06:29 +0000 (14:06 -0500)
ui/src/components/post-listing.tsx

index 56c1f0d9c044bc69a997cbdb1984ef0446efaf0e..ef1dfd603a6f61b12c5a0918486cc58310ade222 100644 (file)
@@ -818,12 +818,19 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
           )
             .then(res => res.json())
             .then(res => {
-              let url = `${window.location.origin}/pictshare/${res.url}`;
-              if (res.filetype == 'mp4') {
-                url += '/raw';
+              if (res.status == 'ok') {
+                let url = `${window.location.origin}/pictshare/${res.url}`;
+                if (res.filetype == 'mp4') {
+                  url += '/raw';
+                }
+                this.state.thumbnail = url;
+                this.setState(this.state);
+              } else {
+                console.error(
+                  `Couldn't cache pictshare url: ${this.state.iframely.thumbnail_url}`
+                );
+                console.error(res);
               }
-              this.state.thumbnail = url;
-              this.setState(this.state);
             });
         }
       })