src/graphql/queries/profileQuery.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 29
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
mnd 0
bc 0
fnc 2
dl 0
loc 29
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import axios from 'axios';
2
import { GITHUB_GRAPHQL, GITHUB_TOKEN } from '../../constants';
3
4
const getProfileQuery = username => `query {
5
  user(login: "${username}") {
6
      avatarUrl
7
      login
8
      followers {
9
        totalCount
10
      }
11
      following {
12
        totalCount
13
      }
14
      starredRepositories {
15
        totalCount
16
      }
17
  }
18
}`;
19
20
export default username => {
21
  return axios({
22
    method: `POST`,
23
    url: GITHUB_GRAPHQL,
24
    data: { query: getProfileQuery(username) },
25
    headers: {
26
      authorization: `Bearer ${GITHUB_TOKEN}`,
27
    },
28
  });
29
};
30