Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Web Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Orlando Piñero
Web Frontend
Commits
e8bd009a
Commit
e8bd009a
authored
2 years ago
by
Orlando Piñero
Browse files
Options
Downloads
Patches
Plain Diff
delete not wroking
parent
8507422c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
my-app/src/actions/AuthenticationActions.js
+4
-2
4 additions, 2 deletions
my-app/src/actions/AuthenticationActions.js
my-app/src/actions/UserManagementActions.js
+10
-47
10 additions, 47 deletions
my-app/src/actions/UserManagementActions.js
with
14 additions
and
49 deletions
my-app/src/actions/AuthenticationActions.js
+
4
−
2
View file @
e8bd009a
...
...
@@ -94,13 +94,15 @@ function handleResponse(response) {
const
data
=
text
&&
JSON
.
parse
(
text
);
var
splittedToken
var
token
var
token
var
adminRights
if
(
authorizationHeader
)
{
splittedToken
=
authorizationHeader
.
split
(
"
"
)[
1
];
token
=
authorizationHeader
splittedToken
=
authorizationHeader
.
split
(
"
"
)[
1
];
adminRights
=
JSON
.
parse
(
atob
(
splittedToken
.
split
(
"
.
"
)[
1
]))
console
.
log
(
adminRights
)
console
.
log
(
token
)
}
if
(
!
response
.
ok
)
{
...
...
This diff is collapsed.
Click to expand it.
my-app/src/actions/UserManagementActions.js
+
10
−
47
View file @
e8bd009a
...
...
@@ -71,23 +71,6 @@ export function getCreateNewUserErrorAction(error) {
}
export
function
getDeleteUserSuccessAction
(
message
)
{
console
.
log
(
"
GetDeleteUserSuccessAction
"
)
return
{
type
:
DELETE_USER_SUCCESS
,
message
:
message
}
}
export
function
getDeleteUserErrorAction
(
error
)
{
console
.
log
(
"
GetDeleteUserErrorAction
"
)
return
{
type
:
DELETE_USER_ERROR
,
error
:
error
}
}
//Frontend Connections
...
...
@@ -161,16 +144,16 @@ export function deleteUserWithUserID(userID, token) {
return
dispatch
=>
{
dispatch
(
getDeleteUserSuccessAction
());
deleteUser
(
userID
,
token
)
.
then
(
successMessage
=>
{
const
action
=
getDeleteUserSuccessAction
(
successMessage
);
dispatch
(
action
);
},
error
=>
{
dispatch
(
getDeleteUserErrorAction
(
error
));
}
).
catch
(
error
=>
{
.
then
(
successMessage
=>
{
const
action
=
getDeleteUserSuccessAction
(
successMessage
);
dispatch
(
action
);
},
error
=>
{
dispatch
(
getDeleteUserErrorAction
(
error
));
}
).
catch
(
error
=>
{
dispatch
(
getDeleteUserErrorAction
(
error
));
})
})
}
}
...
...
@@ -222,26 +205,6 @@ export function createNewUser(userData, token) {
})
}
export
function
deleteUser
(
userID
,
token
)
{
const
requestOptions
=
{
method
:
'
DELETE
'
,
headers
:
{
'
Authorization
'
:
token
}
}
return
fetch
(
'
https://localhost/api/users/
'
+
userID
,
requestOptions
)
.
then
(
response
=>
{
return
response
.
json
().
then
(
body
=>
{
if
(
response
.
status
===
204
)
{
console
.
log
(
body
)
return
body
}
})
})
}
export
function
deleteUser
(
userID
,
token
)
{
console
.
log
(
"
delete user
"
)
...
...
@@ -259,7 +222,7 @@ export function deleteUser(userID, token) {
return
response
.
json
().
then
(()
=>
{
if
(
response
.
status
===
204
)
{
console
.
log
(
"
user successfully deleted
"
)
return
return
}
})
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment