|
1 | 1 | /** |
2 | 2 | * Topcoder TaaS Service for Roles |
3 | 3 | */ |
4 | | - |
5 | | -const mockRoles = [ |
6 | | - { |
7 | | - id: "78c1d981-f235-4a75-97fb-693a26d2a56d", |
8 | | - name: "Python Engineer", |
9 | | - description: "Python Engineer Description", |
10 | | - listOfSkills: [], |
11 | | - imageUrl: "https://svgur.com/i/XdC.svg", |
12 | | - }, |
13 | | - { |
14 | | - id: "bf1011c1-336a-4ec4-aa07-a916d648dbb4", |
15 | | - name: "Android Developer", |
16 | | - description: "Android Developer Description", |
17 | | - listOfSkills: [], |
18 | | - imageUrl: "http://svgur.com/i/Xe_.svg", |
19 | | - }, |
20 | | - { |
21 | | - id: "532433a6-505d-41fe-beb2-815e9b999077", |
22 | | - name: "SQL Engineer", |
23 | | - description: "SQL Engineer Description", |
24 | | - listOfSkills: [], |
25 | | - imageUrl: "http://svgur.com/i/Xe2.svg", |
26 | | - }, |
27 | | - { |
28 | | - id: "3f5ee777-7221-4fe8-ba3a-11cf09077d3f", |
29 | | - name: ".NET Developer", |
30 | | - description: ".NET Developer Description", |
31 | | - listOfSkills: [], |
32 | | - imageUrl: "http://svgur.com/i/XeW.svg", |
33 | | - }, |
34 | | - { |
35 | | - id: "94653ab7-9e48-4ef2-b5c3-cbd720f134ad", |
36 | | - name: "C# Developer", |
37 | | - description: "C# Developer Description", |
38 | | - listOfSkills: [], |
39 | | - imageUrl: "http://svgur.com/i/XeV.svg", |
40 | | - }, |
41 | | - { |
42 | | - id: "b663d69b-fd56-4ab6-8ef6-3560c4ad0be3", |
43 | | - name: "Angular Developer", |
44 | | - description: "Angular Developer Description", |
45 | | - listOfSkills: [], |
46 | | - imageUrl: "http://svgur.com/i/XeX.svg", |
47 | | - }, |
48 | | - { |
49 | | - id: "e1f25908-664f-4956-a069-08017064b4be", |
50 | | - name: "Ajax Developer", |
51 | | - description: "Ajax Developer Description", |
52 | | - listOfSkills: [], |
53 | | - imageUrl: "http://svgur.com/i/Xeu.svg", |
54 | | - }, |
55 | | - { |
56 | | - id: "8d7f43da-d126-4f53-8146-7d874fb44bff", |
57 | | - name: "API Developer", |
58 | | - description: "API Developer Description", |
59 | | - listOfSkills: [], |
60 | | - imageUrl: "http://svgur.com/i/Xcr.svg", |
61 | | - }, |
62 | | - { |
63 | | - id: "98895ea0-f9f8-4abb-ae6b-b00567eafa93", |
64 | | - name: "Python Engineer", |
65 | | - description: "Python Engineer Description", |
66 | | - listOfSkills: [], |
67 | | - imageUrl: "https://svgur.com/i/XdC.svg", |
68 | | - }, |
69 | | - { |
70 | | - id: "212de943-944f-40a1-871a-af384f462644", |
71 | | - name: "Role FallbackIcon", |
72 | | - description: "Role for FallbackIcon Description", |
73 | | - listOfSkills: [], |
74 | | - imageUrl: "https://svgur.com/i/XdC-nonexisting.svg", |
75 | | - }, |
76 | | -]; |
| 4 | +import { axiosInstance as axios } from "./requestInterceptor"; |
| 5 | +import config from "../../config"; |
77 | 6 |
|
78 | 7 | /** |
79 | | - * Mock API request. Returns a list of mock roles. |
| 8 | + * Returns a list of roles. |
80 | 9 | */ |
81 | 10 | export function getRoles() { |
82 | | - return new Promise((resolve) => |
83 | | - setTimeout(resolve, 1500, { data: mockRoles }) |
84 | | - ); |
| 11 | + return axios.get(`${config.API.V5}/taas-roles`); |
85 | 12 | } |
86 | 13 |
|
87 | 14 | /** |
88 | | - * Mock API request. Returns a single role. |
| 15 | + * Returns a single role by id. |
89 | 16 | */ |
90 | 17 | export function getRoleById(id) { |
91 | | - return new Promise((resolve) => |
92 | | - setTimeout(resolve, 1500, { data: mockRoles.find((r) => r.id === id) }) |
93 | | - ); |
| 18 | + return axios.get(`${config.API.V5}/taas-roles/${id}`); |
94 | 19 | } |
0 commit comments