-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
74 lines (60 loc) · 1.78 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import Group from './resources/group';
import User from './resources/user';
import Role from './resources/role';
import Position from './resources/position';
import UserTag from './resources/user-tag';
import GroupTag from './resources/group-tag';
import RoleTag from './resources/role-tag';
import PositionTag from './resources/position-tag';
import UserTagCategory from './resources/user-tag-category';
import GroupTagCategory from './resources/group-tag-category';
import RoleTagCategory from './resources/role-tag-category';
import PositionTagCategory from './resources/position-tag-category';
// TODO Implement Cache
export default class {
constructor(baseUrl, axios, config = {}) {
config.baseURL = baseUrl;
config.withCredentials = true;
if(!Object.prototype.hasOwnProperty.call(config, 'headers')) {
config.headers = {};
}
config.headers['X-Requested-With'] = 'XMLHttpRequest';
this._http = axios.create(config);
}
group() {
return new Group(this._http);
}
user() {
return new User(this._http);
}
role() {
return new Role(this._http);
}
position() {
return new Position(this._http);
}
userTag() {
return new UserTag(this._http);
}
groupTag() {
return new GroupTag(this._http);
}
roleTag() {
return new RoleTag(this._http);
}
positionTag() {
return new PositionTag(this._http);
}
userTagCategory() {
return new UserTagCategory(this._http);
}
groupTagCategory() {
return new GroupTagCategory(this._http);
}
roleTagCategory() {
return new RoleTagCategory(this._http);
}
positionTagCategory() {
return new PositionTagCategory(this._http);
}
}