async assignedIssues()

in src/ui/graphql/apollo_client/resolvers.js [72:106]


    async assignedIssues(_, __, { cache }) {
      const { accessToken, gitlabInstance } = getUserConfigFromCache(cache);
      if (!accessToken) throw new Error('Access token not set.');

      const query = {
        scope: 'assigned_to_me',
        order_by: 'updated_at',
        state: 'opened',
        per_page: 100,
        confidential: false,
      };
      return fetch(restApiUri(gitlabInstance.host, `/issues?${querystring.stringify(query)}`), {
        headers: {
          Authorization: `Bearer ${accessToken}`,
        },
      })
        .then(res => {
          if (res.status !== 200) {
            return res.json().then(({ message }) => {
              throw new Error(message);
            });
          }

          return res;
        })
        .then(res => res.json())
        .then(data => {
          return data.map(issue => {
            return {
              ...toIssue(issue, { projectId: issue.project_id }),
              __typename: 'Issue',
            };
          });
        });
    },