@veritree/services 1.0.0-0 → 1.0.0-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +34 -36
- package/package.json +1 -1
- package/src/{services/countries2.js → endpoints/countries.js} +1 -1
- package/src/endpoints/field-udpate-verifications.js +5 -0
- package/src/endpoints/field-updates.js +5 -0
- package/src/endpoints/forest-type-species.js +5 -0
- package/src/endpoints/forest-types-profiles.js +5 -0
- package/src/endpoints/forest-types.js +5 -0
- package/src/endpoints/form-submissions.js +5 -0
- package/src/{services/images2.js → endpoints/images.js} +1 -1
- package/src/endpoints/notes.js +13 -0
- package/src/endpoints/orgs.js +25 -0
- package/src/{services/regions2.js → endpoints/regions.js} +1 -1
- package/src/endpoints/sdgs.js +5 -0
- package/src/endpoints/sponsors.js +34 -0
- package/src/endpoints/stats.js +17 -0
- package/src/endpoints/subdomains.js +5 -0
- package/src/endpoints/subsite-types.js +5 -0
- package/src/{services/subsites2.js → endpoints/subsites.js} +1 -1
- package/src/endpoints/tags.js +13 -0
- package/src/endpoints/trees-orders.js +6 -0
- package/src/endpoints/user.js +15 -0
- package/src/helpers/api.js +171 -79
- package/src/helpers/relations.js +32 -0
- package/src/helpers/session.js +0 -4
- package/src/utils/args.js +17 -22
- package/src/helpers/api-v2.js +0 -159
- package/src/services/countries.js +0 -35
- package/src/services/field-udpate-verifications.js +0 -34
- package/src/services/field-updates.js +0 -77
- package/src/services/forest-type-species.js +0 -63
- package/src/services/forest-type-species2.js +0 -5
- package/src/services/forest-types.js +0 -62
- package/src/services/forest-types2.js +0 -5
- package/src/services/form-submissions.js +0 -33
- package/src/services/forms.js +0 -33
- package/src/services/images.js +0 -39
- package/src/services/me.js +0 -20
- package/src/services/orgs.js +0 -31
- package/src/services/regions.js +0 -41
- package/src/services/sponsors.js +0 -31
- package/src/services/subdomains.js +0 -26
- package/src/services/subsite-types.js +0 -70
- package/src/services/subsites.js +0 -70
- package/src/services/trees-orders.js +0 -42
- package/src/utils/methods.js +0 -16
package/index.js
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { createTreeOrdersApiService } from './src/services/trees-orders.js';
|
|
1
|
+
import { Countries } from './src/endpoints/countries';
|
|
2
|
+
import { FieldUpdates } from './src/endpoints/field-updates';
|
|
3
|
+
import { FieldUpdateVerifications } from './src/endpoints/field-udpate-verifications';
|
|
4
|
+
import { FormSubmissions } from './src/endpoints/form-submissions';
|
|
5
|
+
import { ForestTypeSpecies } from './src/endpoints/forest-type-species';
|
|
6
|
+
import { ForestTypes } from './src/endpoints/forest-types';
|
|
7
|
+
import { ForestTypeProfiles } from './src/endpoints/forest-types-profiles';
|
|
8
|
+
import { Images } from './src/endpoints/images';
|
|
9
|
+
import { Orgs } from './src/endpoints/orgs';
|
|
10
|
+
import { Notes } from './src/endpoints/notes';
|
|
11
|
+
import { Regions } from './src/endpoints/regions';
|
|
12
|
+
import { SDGs } from './src/endpoints/sdgs';
|
|
13
|
+
import { Sponsors } from './src/endpoints/sponsors';
|
|
14
|
+
import { Stats } from './src/endpoints/stats';
|
|
15
|
+
import { Subdomains } from './src/endpoints/subdomains';
|
|
16
|
+
import { Subsites } from './src/endpoints/subsites';
|
|
17
|
+
import { SubsiteTypes } from './src/endpoints/subsite-types';
|
|
18
|
+
import { Tags } from './src/endpoints/tags';
|
|
19
|
+
import { TreeOrders } from './src/endpoints/trees-orders';
|
|
20
|
+
import { User } from './src/endpoints/user';
|
|
22
21
|
|
|
23
22
|
export {
|
|
24
|
-
createCountriesApiService,
|
|
25
23
|
Countries,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
createForestTypeSpeciesApiService,
|
|
24
|
+
FieldUpdates,
|
|
25
|
+
FieldUpdateVerifications,
|
|
29
26
|
ForestTypeSpecies,
|
|
30
|
-
createForestTypesApiService,
|
|
31
27
|
ForestTypes,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
createImagesApiService,
|
|
28
|
+
ForestTypeProfiles,
|
|
29
|
+
FormSubmissions,
|
|
35
30
|
Images,
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
Orgs,
|
|
32
|
+
Notes,
|
|
38
33
|
Regions,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
SDGs,
|
|
35
|
+
Sponsors,
|
|
36
|
+
Stats,
|
|
37
|
+
Subdomains,
|
|
42
38
|
Subsites,
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
SubsiteTypes,
|
|
40
|
+
Tags,
|
|
41
|
+
TreeOrders,
|
|
42
|
+
User
|
|
45
43
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
|
+
import Relations from "../helpers/relations";
|
|
3
|
+
|
|
4
|
+
class NotesApi extends Api {
|
|
5
|
+
constructor(resource) {
|
|
6
|
+
super(resource);
|
|
7
|
+
this.resource = "notes";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
relation = (prefix, id, args) => new Relations(this, prefix, id, args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Notes = new NotesApi();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
|
+
|
|
3
|
+
class OrgsApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = "orgs";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async stats() {
|
|
10
|
+
const url = `${this._geStatstUrl()}`;
|
|
11
|
+
return await this.get(url);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async publicStats() {
|
|
15
|
+
const url = `${this._geStatstUrl(true)}`;
|
|
16
|
+
return await this.get(url);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_geStatstUrl(isPublic) {
|
|
20
|
+
const endpoint = isPublic ? "pstats" : "stats";
|
|
21
|
+
return `${this.getUrl()}/${endpoint}${this.getUrlParams()}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Orgs = new OrgsApi();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
|
+
|
|
3
|
+
class SponsorsApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = 'sponsors';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async map() {
|
|
10
|
+
this.setOrg();
|
|
11
|
+
|
|
12
|
+
if(!this.orgId) throw new Error('No org id provided');
|
|
13
|
+
|
|
14
|
+
const url = `${this.getUrl()}/${this.orgId}/map-data`;
|
|
15
|
+
return await this.get(url);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async profile() {
|
|
19
|
+
this.setOrg();
|
|
20
|
+
|
|
21
|
+
if(!this.orgId) throw new Error('No org id provided');
|
|
22
|
+
|
|
23
|
+
const url = `${this.getUrl()}/${this.orgId}/profile`;
|
|
24
|
+
return await this.get(url);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async plantingStats(args) {
|
|
28
|
+
const url = `${this.getUrl()}/planting-stats${this.getUrlParams(args)}`;
|
|
29
|
+
return await this.get(url);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Sponsors = new SponsorsApi();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
|
+
|
|
3
|
+
class StatsApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async crumb(id) {
|
|
9
|
+
this.resource = 'pstats';
|
|
10
|
+
const url = `${this.getUrl()}/${id}${this.getUrlParams()}`;
|
|
11
|
+
|
|
12
|
+
return await this.get(url);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Stats = new StatsApi();
|
|
17
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Api from "../helpers/api";
|
|
2
|
+
import Relations from "../helpers/relations";
|
|
3
|
+
|
|
4
|
+
class TagsApi extends Api {
|
|
5
|
+
constructor(resource) {
|
|
6
|
+
super(resource);
|
|
7
|
+
this.resource = "tags";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
relation = (prefix, id, args) => new Relations(this, prefix, id, args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Tags = new TagsApi();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
|
+
|
|
3
|
+
class UserApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = 'me';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async me() {
|
|
10
|
+
const url = `${this.getUrl()}${this.getUrlParams()}`;
|
|
11
|
+
return await this.get(url);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const User = new UserApi();
|
package/src/helpers/api.js
CHANGED
|
@@ -1,117 +1,209 @@
|
|
|
1
1
|
import { getCookie } from "./cookies";
|
|
2
|
+
import { createParamsStringFromArgs } from "../utils/args";
|
|
3
|
+
import { getSession } from "./session";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Adds the envelope argument to the url
|
|
7
|
+
*
|
|
8
|
+
* @param {string} url
|
|
9
|
+
* @returns {string} url
|
|
10
|
+
*/
|
|
11
|
+
function addEnvelopeParam(url) {
|
|
12
|
+
if (!url || url.includes("_result=1")) return url;
|
|
13
|
+
|
|
14
|
+
const urlHasArgs = url.includes("?");
|
|
15
|
+
const urlEvenlopeArg = urlHasArgs ? "&_result=1" : "?_result=1";
|
|
16
|
+
|
|
17
|
+
return `${url}${urlEvenlopeArg}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Handles how the data should be sent in the fetch method
|
|
22
|
+
*
|
|
23
|
+
* @param {string} method
|
|
24
|
+
* @param {object} body
|
|
25
|
+
* @returns {object} data
|
|
26
|
+
*/
|
|
27
|
+
function getConfig(method, data, as) {
|
|
28
|
+
const isGet = method === "get";
|
|
29
|
+
const isSpoofing = as !== undefined;
|
|
30
|
+
const isFormData = data instanceof FormData;
|
|
31
|
+
const accessToken = `Bearer ${getCookie("access_token")}`;
|
|
32
|
+
|
|
33
|
+
const config = {
|
|
34
|
+
method,
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: accessToken,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (!isFormData) {
|
|
41
|
+
config.headers["Content-Type"] = "application/json";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// TODO: improve this ifs and elses
|
|
45
|
+
if (!isGet) {
|
|
46
|
+
if (!data) data = {};
|
|
47
|
+
|
|
48
|
+
if (isFormData) {
|
|
49
|
+
if (isSpoofing) data.set("_method", as.toUpperCase());
|
|
50
|
+
config.body = data;
|
|
51
|
+
} else {
|
|
52
|
+
if (isSpoofing) data._method = as.toUpperCase();
|
|
53
|
+
config.body = JSON.stringify(data);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return config;
|
|
58
|
+
}
|
|
2
59
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
60
|
+
export default class Api {
|
|
61
|
+
constructor(resource) {
|
|
62
|
+
this.baseUrl = `${process.env.API_VERITREE_URL}/api`;
|
|
63
|
+
this.resource = resource ? resource : "";
|
|
64
|
+
this.orgId = null;
|
|
65
|
+
this.orgType = null;
|
|
66
|
+
}
|
|
6
67
|
|
|
7
68
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {string} url
|
|
69
|
+
*
|
|
10
70
|
* @returns {promise}
|
|
11
71
|
*/
|
|
12
|
-
async
|
|
13
|
-
|
|
14
|
-
|
|
72
|
+
async all(args) {
|
|
73
|
+
const url = `${this.getUrl()}${this.getUrlParams(args)}`;
|
|
74
|
+
return await this.get(url);
|
|
75
|
+
}
|
|
15
76
|
|
|
16
77
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {string}
|
|
19
|
-
* @param {object}
|
|
78
|
+
*
|
|
79
|
+
* @param {string, number} id
|
|
80
|
+
* @param {object} args/params
|
|
20
81
|
* @returns {promise}
|
|
21
82
|
*/
|
|
22
|
-
async
|
|
23
|
-
|
|
24
|
-
|
|
83
|
+
async single(id, args) {
|
|
84
|
+
const url = `${this.getUrl(id)}${this.getUrlParams(args)}`;
|
|
85
|
+
return await this.get(url);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @param {object} data
|
|
91
|
+
* @returns {promise}
|
|
92
|
+
*/
|
|
93
|
+
async create(data) {
|
|
94
|
+
return await this.post(null, data);
|
|
95
|
+
}
|
|
25
96
|
|
|
26
97
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param {string} url
|
|
29
|
-
* @param {object} data
|
|
98
|
+
*
|
|
99
|
+
* @param {string} url
|
|
100
|
+
* @param {object} data
|
|
30
101
|
* @param {string} as - 'put' // necessary for updates because of how Laravel handles PUT requests
|
|
31
102
|
* @returns {promise}
|
|
32
103
|
*/
|
|
33
|
-
async update(
|
|
104
|
+
async update(id, data, as = "put") {
|
|
105
|
+
const url = `${this.getUrl(id)}${this.getUrlParams()}`;
|
|
34
106
|
return await this.post(url, data, as);
|
|
35
|
-
}
|
|
107
|
+
}
|
|
36
108
|
|
|
37
109
|
/**
|
|
38
|
-
* Deals with all fetch requests
|
|
39
110
|
*
|
|
40
111
|
* @param {string} url
|
|
41
|
-
* @param {string} method
|
|
42
112
|
* @param {object} data
|
|
43
|
-
* @
|
|
113
|
+
* @param {string} as - 'put' // necessary for updates because of how Laravel handles PUT requests
|
|
114
|
+
* @returns {promise}
|
|
44
115
|
*/
|
|
45
|
-
async
|
|
46
|
-
|
|
47
|
-
|
|
116
|
+
async delete(id) {
|
|
117
|
+
const url = `${this.getUrl(id)}${this.getUrlParams()}`;
|
|
118
|
+
return await this.post(url, null, "delete");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param {string} url
|
|
124
|
+
* @returns {promise}
|
|
125
|
+
*/
|
|
126
|
+
async get(url) {
|
|
127
|
+
return await this.unWrap(url);
|
|
128
|
+
}
|
|
48
129
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @param {string} url
|
|
133
|
+
* @param {object} data
|
|
134
|
+
* @returns {promise}
|
|
135
|
+
*/
|
|
136
|
+
async post(url, data, as) {
|
|
137
|
+
if (!url) url = `${this.getUrl()}${this.getUrlParams()}`;
|
|
138
|
+
return await this.unWrap(url, "post", data, as);
|
|
139
|
+
}
|
|
52
140
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
141
|
+
// ----------
|
|
142
|
+
// --
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param {string, number} id
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
getUrl(id) {
|
|
149
|
+
id = id ? `/${id}` : "";
|
|
150
|
+
return `${this.baseUrl}/${this.resource}${id}`;
|
|
151
|
+
}
|
|
58
152
|
|
|
59
153
|
/**
|
|
60
|
-
* Handles how the data should be sent in the fetch method
|
|
61
154
|
*
|
|
62
|
-
* @param {
|
|
63
|
-
* @
|
|
64
|
-
* @returns {object} data
|
|
155
|
+
* @param {object} args
|
|
156
|
+
* @returns {string}
|
|
65
157
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Authorization: accessToken,
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
if(!isFormData) {
|
|
80
|
-
config.headers['Content-Type'] = 'application/json';
|
|
158
|
+
getUrlParams(args) {
|
|
159
|
+
this.setOrg();
|
|
160
|
+
let isOrgLess = false;
|
|
161
|
+
let orgIdParam = "";
|
|
162
|
+
let orgTypeParam = "";
|
|
163
|
+
|
|
164
|
+
// while most of endpoints require an org id and type, some endpoints do not
|
|
165
|
+
if (args && args.length) {
|
|
166
|
+
isOrgLess = Object.hasOwnProperty.call(...args, "orgless");
|
|
81
167
|
}
|
|
82
168
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if(
|
|
86
|
-
if(isPut) data.set('_method', 'PUT');
|
|
87
|
-
config.body = data;
|
|
88
|
-
} else {
|
|
89
|
-
if(isPut) data._method = 'PUT';
|
|
90
|
-
config.body = JSON.stringify(data);
|
|
91
|
-
}
|
|
169
|
+
if (!isOrgLess) {
|
|
170
|
+
if (this.orgId) orgIdParam = `org_id=${this.orgId}`;
|
|
171
|
+
if (this.orgType) orgTypeParam = `&org_type=${this.orgType}`;
|
|
92
172
|
}
|
|
93
173
|
|
|
94
|
-
return
|
|
95
|
-
}
|
|
174
|
+
return `?${orgIdParam}${orgTypeParam}${createParamsStringFromArgs(args)}`;
|
|
175
|
+
}
|
|
96
176
|
|
|
97
177
|
/**
|
|
98
|
-
*
|
|
178
|
+
* Deals with all fetch requests
|
|
99
179
|
*
|
|
100
180
|
* @param {string} url
|
|
101
|
-
* @
|
|
181
|
+
* @param {string} method
|
|
182
|
+
* @param {object} data
|
|
183
|
+
* @returns {object} envelope
|
|
102
184
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return data instanceof FormData;
|
|
114
|
-
},
|
|
115
|
-
};
|
|
185
|
+
async unWrap(url, method = "get", data, as) {
|
|
186
|
+
url = addEnvelopeParam(url);
|
|
187
|
+
const config = getConfig(method, data, as);
|
|
188
|
+
const response = await fetch(url, config);
|
|
189
|
+
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
if (response.ok && response.status === 204) {
|
|
192
|
+
resolve();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
116
195
|
|
|
117
|
-
|
|
196
|
+
response.json().then((json) => {
|
|
197
|
+
response.ok ? resolve(json) : reject(json);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
setOrg() {
|
|
203
|
+
const session = getSession();
|
|
204
|
+
if (!session) return;
|
|
205
|
+
const { orgId, orgType } = session;
|
|
206
|
+
this.orgId = orgId;
|
|
207
|
+
this.orgType = orgType;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const Relations = (api, prefix, id, args) => {
|
|
2
|
+
let url = `${api.baseUrl}/${prefix}/${id}/${api.resource}`;
|
|
3
|
+
|
|
4
|
+
const all = async () => {
|
|
5
|
+
url = `${url}${api.getUrlParams(args)}`;
|
|
6
|
+
return await api.unWrap(url);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const single = async(tagId) => {
|
|
10
|
+
url = `${url}/${tagId}${api.getUrlParams(args)}`;
|
|
11
|
+
return await api.unWrap(url);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const attach = async(tagId, data) => {
|
|
15
|
+
url = `${url}/${tagId}/attach${api.getUrlParams(args)}`;
|
|
16
|
+
return await api.post(url, data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const detach = async(tagId, data) => {
|
|
20
|
+
url = `${url}/${tagId}/detach${api.getUrlParams(args)}`;
|
|
21
|
+
return await api.delete(url, data);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
all,
|
|
26
|
+
single,
|
|
27
|
+
attach,
|
|
28
|
+
detach
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Relations;
|