| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 29 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 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 |