@shakerquiz/utilities 0.2.17 → 0.2.19
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/package.json +1 -1
- package/source/enumerations/constants.js +2 -2
- package/source/enumerations/cookies.js +1 -1
- package/source/enumerations/features.js +128 -51
- package/source/enumerations/game-statuses.js +31 -31
- package/source/enumerations/kinds.js +1 -1
- package/source/enumerations/methods.js +2 -1
- package/source/enumerations/networks.js +2 -2
- package/source/enumerations/regexps.js +0 -2
- package/source/enumerations/roles.js +5 -5
- package/source/functions/{request.js → fetch.js} +58 -54
- package/source/globals.d.ts +422 -0
- package/source/index.d.ts +1 -2
- package/source/index.js +2 -2
- package/source/enumerations/constants.d.ts +0 -3
- package/source/enumerations/cookies.d.ts +0 -5
- package/source/enumerations/features.d.ts +0 -83
- package/source/enumerations/game-statuses.d.ts +0 -43
- package/source/enumerations/kinds.d.ts +0 -4
- package/source/enumerations/methods.d.ts +0 -7
- package/source/enumerations/networks.d.ts +0 -4
- package/source/enumerations/patterns.d.ts +0 -38
- package/source/enumerations/patterns.js +0 -66
- package/source/enumerations/phases.d.ts +0 -11
- package/source/enumerations/regexps.d.ts +0 -4
- package/source/enumerations/roles.d.ts +0 -9
- package/source/enumerations/services.d.ts +0 -5
- package/source/enumerations/services.js +0 -5
- package/source/functions/request.d.ts +0 -447
package/package.json
CHANGED
|
@@ -1,70 +1,147 @@
|
|
|
1
1
|
import { Kinds } from './kinds.js'
|
|
2
|
-
import {
|
|
2
|
+
import { Networks } from './networks.js'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export var Features = /** @type {const} */ ({
|
|
5
5
|
Checkin: 'Checkin',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Users: 'Users',
|
|
9
|
-
|
|
10
|
-
Theme: 'Theme',
|
|
11
|
-
Themes: 'Themes',
|
|
12
|
-
|
|
6
|
+
Cities: 'Cities',
|
|
7
|
+
City: 'City',
|
|
13
8
|
Game: 'Game',
|
|
14
9
|
Games: 'Games',
|
|
15
|
-
|
|
16
|
-
Registration: 'Registration',
|
|
17
|
-
Registrations: 'Registrations',
|
|
18
|
-
|
|
19
|
-
City: 'City',
|
|
20
|
-
Cities: 'Cities',
|
|
21
|
-
|
|
22
10
|
Location: 'Location',
|
|
23
11
|
Locations: 'Locations',
|
|
12
|
+
Registration: 'Registration',
|
|
13
|
+
Registrations: 'Registrations',
|
|
14
|
+
Theme: 'Theme',
|
|
15
|
+
Themes: 'Themes',
|
|
16
|
+
User: 'User',
|
|
17
|
+
Users: 'Users',
|
|
24
18
|
})
|
|
25
19
|
|
|
26
|
-
export
|
|
20
|
+
export var FeatureKinds = {
|
|
27
21
|
[Features.Checkin]: Kinds.Item,
|
|
28
|
-
|
|
29
|
-
[Features.
|
|
30
|
-
[Features.Users]: Kinds.List,
|
|
31
|
-
|
|
32
|
-
[Features.Theme]: Kinds.Item,
|
|
33
|
-
[Features.Themes]: Kinds.List,
|
|
34
|
-
|
|
22
|
+
[Features.Cities]: Kinds.List,
|
|
23
|
+
[Features.City]: Kinds.Item,
|
|
35
24
|
[Features.Game]: Kinds.Item,
|
|
36
25
|
[Features.Games]: Kinds.List,
|
|
37
|
-
|
|
38
|
-
[Features.Registration]: Kinds.Item,
|
|
39
|
-
[Features.Registrations]: Kinds.List,
|
|
40
|
-
|
|
41
|
-
[Features.City]: Kinds.Item,
|
|
42
|
-
[Features.Cities]: Kinds.List,
|
|
43
|
-
|
|
44
26
|
[Features.Location]: Kinds.Item,
|
|
45
27
|
[Features.Locations]: Kinds.List,
|
|
28
|
+
[Features.Registration]: Kinds.Item,
|
|
29
|
+
[Features.Registrations]: Kinds.List,
|
|
30
|
+
[Features.Theme]: Kinds.Item,
|
|
31
|
+
[Features.Themes]: Kinds.List,
|
|
32
|
+
[Features.User]: Kinds.Item,
|
|
33
|
+
[Features.Users]: Kinds.List,
|
|
46
34
|
}
|
|
47
35
|
|
|
48
|
-
export
|
|
49
|
-
[Features.Checkin]:
|
|
50
|
-
|
|
51
|
-
[Features.
|
|
52
|
-
[Features.
|
|
53
|
-
|
|
54
|
-
[Features.
|
|
55
|
-
[Features.
|
|
56
|
-
|
|
57
|
-
[Features.
|
|
58
|
-
[Features.
|
|
59
|
-
|
|
60
|
-
[Features.
|
|
61
|
-
[Features.
|
|
62
|
-
|
|
63
|
-
[Features.City]: Services.Locations,
|
|
64
|
-
[Features.Cities]: Services.Locations,
|
|
36
|
+
export var FeaturePathnames = /** @type {const} */ ({
|
|
37
|
+
[Features.Checkin]: '/checkin',
|
|
38
|
+
[Features.Cities]: '/cities',
|
|
39
|
+
[Features.City]: '/city/:city?',
|
|
40
|
+
[Features.Game]: '/game/:game?',
|
|
41
|
+
[Features.Games]: '/games',
|
|
42
|
+
[Features.Location]: '/location/:location?',
|
|
43
|
+
[Features.Locations]: '/locations',
|
|
44
|
+
[Features.Registration]: '/registration/:registration?',
|
|
45
|
+
[Features.Registrations]: '/registrations',
|
|
46
|
+
[Features.Theme]: '/theme/:theme?',
|
|
47
|
+
[Features.Themes]: '/themes',
|
|
48
|
+
[Features.User]: '/user/:user?',
|
|
49
|
+
[Features.Users]: '/users',
|
|
50
|
+
})
|
|
65
51
|
|
|
66
|
-
|
|
67
|
-
[Features.
|
|
52
|
+
export var FeaturePatterns = {
|
|
53
|
+
[Features.Checkin]: new URLPattern({
|
|
54
|
+
pathname: FeaturePathnames[Features.Checkin],
|
|
55
|
+
}),
|
|
56
|
+
[Features.Cities]: new URLPattern({
|
|
57
|
+
pathname: FeaturePathnames[Features.Cities],
|
|
58
|
+
}),
|
|
59
|
+
[Features.City]: new URLPattern({
|
|
60
|
+
pathname: FeaturePathnames[Features.City],
|
|
61
|
+
}),
|
|
62
|
+
[Features.Game]: new URLPattern({
|
|
63
|
+
pathname: FeaturePathnames[Features.Game],
|
|
64
|
+
}),
|
|
65
|
+
[Features.Games]: new URLPattern({
|
|
66
|
+
pathname: FeaturePathnames[Features.Games],
|
|
67
|
+
}),
|
|
68
|
+
[Features.Location]: new URLPattern({
|
|
69
|
+
pathname: FeaturePathnames[Features.Location],
|
|
70
|
+
}),
|
|
71
|
+
[Features.Locations]: new URLPattern({
|
|
72
|
+
pathname: FeaturePathnames[Features.Locations],
|
|
73
|
+
}),
|
|
74
|
+
[Features.Registration]: new URLPattern({
|
|
75
|
+
pathname: FeaturePathnames[Features.Registration],
|
|
76
|
+
}),
|
|
77
|
+
[Features.Registrations]: new URLPattern({
|
|
78
|
+
pathname: FeaturePathnames[Features.Registrations],
|
|
79
|
+
}),
|
|
80
|
+
[Features.Theme]: new URLPattern({
|
|
81
|
+
pathname: FeaturePathnames[Features.Theme],
|
|
82
|
+
}),
|
|
83
|
+
[Features.Themes]: new URLPattern({
|
|
84
|
+
pathname: FeaturePathnames[Features.Themes],
|
|
85
|
+
}),
|
|
86
|
+
[Features.User]: new URLPattern({
|
|
87
|
+
pathname: FeaturePathnames[Features.User],
|
|
88
|
+
}),
|
|
89
|
+
[Features.Users]: new URLPattern({
|
|
90
|
+
pathname: FeaturePathnames[Features.Users],
|
|
91
|
+
}),
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
export
|
|
94
|
+
export var FeatureNetworkOrigins = /** @type {const} */ ({
|
|
95
|
+
[Features.Checkin]: {
|
|
96
|
+
[Networks.Private]: 'http://users/',
|
|
97
|
+
[Networks.Public]: 'https://users.backend.shakerquiz.ru/',
|
|
98
|
+
},
|
|
99
|
+
[Features.Cities]: {
|
|
100
|
+
[Networks.Private]: 'http://locations/',
|
|
101
|
+
[Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
|
|
102
|
+
},
|
|
103
|
+
[Features.City]: {
|
|
104
|
+
[Networks.Private]: 'http://locations/',
|
|
105
|
+
[Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
|
|
106
|
+
},
|
|
107
|
+
[Features.Game]: {
|
|
108
|
+
[Networks.Private]: 'http://games/',
|
|
109
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
110
|
+
},
|
|
111
|
+
[Features.Games]: {
|
|
112
|
+
[Networks.Private]: 'http://games/',
|
|
113
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
114
|
+
},
|
|
115
|
+
[Features.Location]: {
|
|
116
|
+
[Networks.Private]: 'http://locations/',
|
|
117
|
+
[Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
|
|
118
|
+
},
|
|
119
|
+
[Features.Locations]: {
|
|
120
|
+
[Networks.Private]: 'http://locations/',
|
|
121
|
+
[Networks.Public]: 'https://locations.backend.shakerquiz.ru/',
|
|
122
|
+
},
|
|
123
|
+
[Features.Registration]: {
|
|
124
|
+
[Networks.Private]: 'http://games/',
|
|
125
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
126
|
+
},
|
|
127
|
+
[Features.Registrations]: {
|
|
128
|
+
[Networks.Private]: 'http://games/',
|
|
129
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
130
|
+
},
|
|
131
|
+
[Features.Theme]: {
|
|
132
|
+
[Networks.Private]: 'http://games/',
|
|
133
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
134
|
+
},
|
|
135
|
+
[Features.Themes]: {
|
|
136
|
+
[Networks.Private]: 'http://games/',
|
|
137
|
+
[Networks.Public]: 'https://games.backend.shakerquiz.ru/',
|
|
138
|
+
},
|
|
139
|
+
[Features.User]: {
|
|
140
|
+
[Networks.Private]: 'http://users/',
|
|
141
|
+
[Networks.Public]: 'https://users.backend.shakerquiz.ru/',
|
|
142
|
+
},
|
|
143
|
+
[Features.Users]: {
|
|
144
|
+
[Networks.Private]: 'http://users/',
|
|
145
|
+
[Networks.Public]: 'https://users.backend.shakerquiz.ru/',
|
|
146
|
+
},
|
|
147
|
+
})
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { Roles } from './roles.js'
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
3
|
+
export var GameStatuses = /** @type {const} */ ({
|
|
4
|
+
APPROVED: 'APPROVED',
|
|
5
|
+
ARCHIVE: 'ARCHIVE',
|
|
6
|
+
CLOSED: 'CLOSED',
|
|
7
|
+
FINISHED: 'FINISHED',
|
|
8
|
+
FORINVITES: 'FORINVITES',
|
|
9
|
+
MODERATION: 'MODERATION',
|
|
10
|
+
PUBLISHED: 'PUBLISHED',
|
|
11
|
+
REJECTED: 'REJECTED',
|
|
12
|
+
IS_RESERVE: 'IS_RESERVE',
|
|
13
|
+
})
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
[Roles.
|
|
17
|
-
GameStatuses.
|
|
18
|
-
GameStatuses.
|
|
19
|
-
GameStatuses.
|
|
20
|
-
GameStatuses.
|
|
21
|
-
GameStatuses.
|
|
22
|
-
GameStatuses.
|
|
23
|
-
GameStatuses.
|
|
24
|
-
GameStatuses.
|
|
25
|
-
GameStatuses.
|
|
15
|
+
export var RoleGameStatuses = {
|
|
16
|
+
[Roles.admin]: [
|
|
17
|
+
GameStatuses.APPROVED,
|
|
18
|
+
GameStatuses.MODERATION,
|
|
19
|
+
GameStatuses.PUBLISHED,
|
|
20
|
+
GameStatuses.REJECTED,
|
|
21
|
+
GameStatuses.FINISHED,
|
|
22
|
+
GameStatuses.ARCHIVE,
|
|
23
|
+
GameStatuses.FORINVITES,
|
|
24
|
+
GameStatuses.IS_RESERVE,
|
|
25
|
+
GameStatuses.CLOSED,
|
|
26
26
|
],
|
|
27
27
|
|
|
28
|
-
[Roles.
|
|
29
|
-
GameStatuses.
|
|
30
|
-
GameStatuses.
|
|
31
|
-
GameStatuses.
|
|
32
|
-
GameStatuses.
|
|
33
|
-
GameStatuses.
|
|
34
|
-
GameStatuses.
|
|
35
|
-
GameStatuses.
|
|
28
|
+
[Roles.organizer]: [
|
|
29
|
+
GameStatuses.APPROVED,
|
|
30
|
+
GameStatuses.PUBLISHED,
|
|
31
|
+
GameStatuses.FINISHED,
|
|
32
|
+
GameStatuses.ARCHIVE,
|
|
33
|
+
GameStatuses.FORINVITES,
|
|
34
|
+
GameStatuses.IS_RESERVE,
|
|
35
|
+
GameStatuses.CLOSED,
|
|
36
36
|
],
|
|
37
37
|
|
|
38
|
-
[Roles.
|
|
38
|
+
[Roles.default]: [],
|
|
39
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
export var Roles = /** @type {const} */ ({
|
|
2
|
+
admin: 'admin',
|
|
3
|
+
organizer: 'organizer',
|
|
4
|
+
default: 'default',
|
|
5
|
+
})
|
|
@@ -2,15 +2,19 @@ import * as cookies from '@yurkimus/cookies'
|
|
|
2
2
|
import { MessageError } from '@yurkimus/errors'
|
|
3
3
|
import * as message from '@yurkimus/message'
|
|
4
4
|
import { ResponseStatus } from '@yurkimus/response-status'
|
|
5
|
+
import { url } from '@yurkimus/url'
|
|
5
6
|
|
|
6
7
|
import { Cookies } from '../enumerations/cookies.js'
|
|
7
8
|
import {
|
|
8
9
|
FeatureKinds,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
FeatureNetworkOrigins,
|
|
11
|
+
FeaturePathnames,
|
|
12
|
+
Features,
|
|
11
13
|
} from '../enumerations/features.js'
|
|
12
14
|
import { Kinds } from '../enumerations/kinds.js'
|
|
13
|
-
import {
|
|
15
|
+
import { Methods } from '../enumerations/methods.js'
|
|
16
|
+
import { Networks } from '../enumerations/networks.js'
|
|
17
|
+
import { Roles } from '../enumerations/roles.js'
|
|
14
18
|
|
|
15
19
|
let handleMessage = (feature, [response, body]) => {
|
|
16
20
|
switch (response.status) {
|
|
@@ -27,28 +31,18 @@ let handleMessage = (feature, [response, body]) => {
|
|
|
27
31
|
return []
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
case 401:
|
|
32
|
-
case 403:
|
|
33
|
-
case 404:
|
|
34
|
-
case 409:
|
|
35
|
-
case 415:
|
|
36
|
-
case 500:
|
|
37
|
-
case 502:
|
|
34
|
+
default:
|
|
38
35
|
throw MessageError(
|
|
39
|
-
body
|
|
36
|
+
body?.message ?? '',
|
|
40
37
|
ResponseStatus(response.status),
|
|
41
38
|
)
|
|
42
|
-
|
|
43
|
-
default:
|
|
44
|
-
throw body
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
41
|
|
|
48
42
|
/**
|
|
49
|
-
* @template {
|
|
50
|
-
* @template {
|
|
51
|
-
* @template {
|
|
43
|
+
* @template {keyof typeof Features} Feature
|
|
44
|
+
* @template {keyof typeof Methods} Method
|
|
45
|
+
* @template {keyof typeof Networks} Network
|
|
52
46
|
*
|
|
53
47
|
* @param {Feature} feature
|
|
54
48
|
* @param {Method} method
|
|
@@ -56,36 +50,37 @@ let handleMessage = (feature, [response, body]) => {
|
|
|
56
50
|
* @param {import('@yurkimus/url').URLOptions | undefined} options
|
|
57
51
|
* @param {RequestInit} init
|
|
58
52
|
*/
|
|
59
|
-
let
|
|
53
|
+
let request = (feature, method, network, options, init) => {
|
|
60
54
|
if (!('method' in init))
|
|
61
55
|
init.method = method
|
|
62
56
|
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
undefined,
|
|
68
|
-
FeaturePatterns[feature].pathname,
|
|
57
|
+
let instance = new Request(
|
|
58
|
+
url(
|
|
59
|
+
FeatureNetworkOrigins[feature][network],
|
|
60
|
+
FeaturePathnames[feature],
|
|
69
61
|
options,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
),
|
|
63
|
+
init,
|
|
64
|
+
)
|
|
73
65
|
|
|
74
|
-
if (!
|
|
75
|
-
|
|
66
|
+
if (!instance.headers.has('Content-Type'))
|
|
67
|
+
instance.headers.set(
|
|
76
68
|
'Content-Type',
|
|
77
69
|
'application/json',
|
|
78
70
|
)
|
|
79
71
|
|
|
80
72
|
if ('cookie' in init)
|
|
81
|
-
|
|
73
|
+
instance.headers.set(
|
|
82
74
|
'Authorization',
|
|
83
75
|
cookies.read(Cookies.Token, init.cookie),
|
|
84
76
|
)
|
|
85
77
|
|
|
86
|
-
return fetch(
|
|
78
|
+
return fetch(instance)
|
|
87
79
|
.then(message.read)
|
|
88
|
-
.then(handleMessage.bind(
|
|
80
|
+
.then(handleMessage.bind(
|
|
81
|
+
undefined,
|
|
82
|
+
feature,
|
|
83
|
+
))
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
/**
|
|
@@ -94,45 +89,54 @@ let makeRequest = (feature, method, network, options, init) => {
|
|
|
94
89
|
export let Extensions = new WeakMap()
|
|
95
90
|
|
|
96
91
|
/**
|
|
97
|
-
* @template {
|
|
98
|
-
* @template {
|
|
99
|
-
* @template {
|
|
92
|
+
* @template {keyof typeof Features} Feature
|
|
93
|
+
* @template {keyof typeof Methods} Method
|
|
94
|
+
* @template {keyof typeof Networks} Network
|
|
100
95
|
*
|
|
101
96
|
* @param {Feature} feature
|
|
102
97
|
* @param {Method} method
|
|
103
98
|
* @param {Network} network
|
|
104
99
|
*/
|
|
105
|
-
export let
|
|
106
|
-
if (!(feature in
|
|
100
|
+
export let useFetch = (feature, method, network) => {
|
|
101
|
+
if (!(feature in Features))
|
|
102
|
+
throw TypeError(
|
|
103
|
+
`Feature '${feature}' must be listed in 'Features'.`,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
if (!(method in Methods))
|
|
107
107
|
throw TypeError(
|
|
108
|
-
`
|
|
108
|
+
`Method '${method}' must be listed in 'Methods'.`,
|
|
109
109
|
)
|
|
110
110
|
|
|
111
|
-
if (!(feature in
|
|
111
|
+
if (!(feature in FeaturePathnames))
|
|
112
112
|
throw TypeError(
|
|
113
|
-
`Feature '${feature}' must be listed in '
|
|
113
|
+
`Feature '${feature}' must be listed in 'FeaturePathnames'.`,
|
|
114
114
|
)
|
|
115
115
|
|
|
116
|
-
if (!
|
|
116
|
+
if (!(feature in FeatureNetworkOrigins))
|
|
117
117
|
throw TypeError(
|
|
118
|
-
`
|
|
119
|
-
FeatureServices[feature]
|
|
120
|
-
}' must be listed in 'FeatureOrigins'.`,
|
|
118
|
+
`Feature '${feature}' must be listed in 'FeatureNetworkOrigins'.`,
|
|
121
119
|
)
|
|
122
120
|
|
|
123
|
-
if (!
|
|
121
|
+
if (!(network in FeatureNetworkOrigins[feature]))
|
|
124
122
|
throw TypeError(
|
|
125
|
-
`Network '${
|
|
123
|
+
`Network '${
|
|
124
|
+
FeatureNetworkOrigins[feature]
|
|
125
|
+
}' must be listed in 'FeatureNetworkOrigins[feature]'.`,
|
|
126
126
|
)
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
+
* @template {keyof typeof Roles} Role
|
|
130
|
+
*
|
|
129
131
|
* @param {import('@yurkimus/url').URLOptions} options
|
|
130
132
|
* @param {RequestInit} init
|
|
133
|
+
*
|
|
134
|
+
* @returns {Promise<FetchResults[Feature][Method][Role]>}
|
|
131
135
|
*/
|
|
132
|
-
let
|
|
136
|
+
let fetch = (options, init) => {
|
|
133
137
|
let onbefore = parameters => {
|
|
134
138
|
let predicates = Extensions
|
|
135
|
-
.get(
|
|
139
|
+
.get(fetch)
|
|
136
140
|
.get('onbefore')
|
|
137
141
|
|
|
138
142
|
return (predicates.size > 0)
|
|
@@ -147,7 +151,7 @@ export let useRequest = (feature, method, network) => {
|
|
|
147
151
|
|
|
148
152
|
let onfulfilled = contract => {
|
|
149
153
|
let predicates = Extensions
|
|
150
|
-
.get(
|
|
154
|
+
.get(fetch)
|
|
151
155
|
.get('onfulfilled')
|
|
152
156
|
|
|
153
157
|
return (predicates.size > 0)
|
|
@@ -162,7 +166,7 @@ export let useRequest = (feature, method, network) => {
|
|
|
162
166
|
|
|
163
167
|
let onrejected = reason => {
|
|
164
168
|
let predicates = Extensions
|
|
165
|
-
.get(
|
|
169
|
+
.get(fetch)
|
|
166
170
|
.get('onrejected')
|
|
167
171
|
|
|
168
172
|
Array
|
|
@@ -180,7 +184,7 @@ export let useRequest = (feature, method, network) => {
|
|
|
180
184
|
}
|
|
181
185
|
})
|
|
182
186
|
.then(([options, init]) =>
|
|
183
|
-
|
|
187
|
+
request(
|
|
184
188
|
feature,
|
|
185
189
|
method,
|
|
186
190
|
network,
|
|
@@ -193,7 +197,7 @@ export let useRequest = (feature, method, network) => {
|
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
Extensions.set(
|
|
196
|
-
|
|
200
|
+
fetch,
|
|
197
201
|
new Map([
|
|
198
202
|
['onbefore', new Set([])],
|
|
199
203
|
['onfulfilled', new Set([])],
|
|
@@ -201,5 +205,5 @@ export let useRequest = (feature, method, network) => {
|
|
|
201
205
|
]),
|
|
202
206
|
)
|
|
203
207
|
|
|
204
|
-
return
|
|
208
|
+
return fetch
|
|
205
209
|
}
|