acmcsufoss / lc-dailies

Daily Leetcode challenges for members to practice their algorithms.
https://acmcsuf.com/lc-dailies
MIT License
2 stars 0 forks source link

Fix gql response interpretation #49

Closed EthanThatOneKid closed 9 months ago

EthanThatOneKid commented 9 months ago

Fixed error

TypeError: Cannot read properties of null (reading 'map')

Revision

      .then((json) =>
        json.data.recentAcSubmissionList
-          .map((
+          ?.map((
            acSubmission: {
              id: string;
              title: string;
@@ -154,7 +132,7 @@ export class LCClient {
            name: acSubmission.titleSlug,
            title: acSubmission.title,
            timestamp: acSubmission.timestamp,
-          }))
+          })) ?? []
      );

Resolves #48.