Add: unified requests with pre users endpoint
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
},
|
||||
"requests": {
|
||||
"all": "/requests",
|
||||
"waitlist": "/requests/waitlist",
|
||||
"withPreUser": "/requests/with-pre-user",
|
||||
"byId": "/requests/:requestId",
|
||||
"count": "/requests/count",
|
||||
"mine": "/requests/mine",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
},
|
||||
"requests": {
|
||||
"all": "/requests",
|
||||
"waitlist": "/requests/waitlist",
|
||||
"withPreUser": "/requests/with-pre-user",
|
||||
"byId": "/requests/:requestId",
|
||||
"count": "/requests/count",
|
||||
"mine": "/requests/mine",
|
||||
|
||||
@@ -70,6 +70,7 @@ const Perfil = () => {
|
||||
myIncomesUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.incomes.mine),
|
||||
requestUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.requests.all),
|
||||
preUsersUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.preUsers.all),
|
||||
requestWithPreUserUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.requests.withPreUser),
|
||||
preUserValidationUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.preUsers.validate),
|
||||
myRequestsUrl: buildUrl(config.apiConfig.baseUrl, config.apiConfig.endpoints.requests.mine),
|
||||
changePasswordUrl: buildUrl(config.apiConfig.coreUrl, config.apiConfig.endpoints.auth.changePassword),
|
||||
@@ -444,18 +445,15 @@ const PerfilContent = ({ config }) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const request = await postData(config.requestUrl, {
|
||||
type: CONSTANTS.REQUEST_TYPE_ADD_COLLABORATOR,
|
||||
status: CONSTANTS.REQUEST_PENDING,
|
||||
requestedBy: identity.user.userId
|
||||
});
|
||||
|
||||
const requestId = request?.requestId;
|
||||
if (!requestId) throw new Error("No se pudo crear la solicitud.");
|
||||
|
||||
await postData(config.preUsersUrl, {
|
||||
...formData,
|
||||
requestId: requestId
|
||||
await postData(config.requestWithPreUserUrl, {
|
||||
request: {
|
||||
type: CONSTANTS.REQUEST_TYPE_ADD_COLLABORATOR,
|
||||
status: CONSTANTS.REQUEST_PENDING,
|
||||
requestedBy: identity.user.userId
|
||||
},
|
||||
preUser: {
|
||||
...formData
|
||||
}
|
||||
});
|
||||
|
||||
setValidationErrors({});
|
||||
|
||||
Reference in New Issue
Block a user