Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
admin-localhome
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
localhome
admin-localhome
Commits
f12e32bb
Commit
f12e32bb
authored
Feb 22, 2018
by
chencheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
9. Handle user delete
parent
156220ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
Users.js
src/pages/users/components/Users.js
+4
-1
users.js
src/pages/users/models/users.js
+5
-0
users.js
src/pages/users/services/users.js
+6
-0
No files found.
src/pages/users/components/Users.js
View file @
f12e32bb
...
...
@@ -6,7 +6,10 @@ import { PAGE_SIZE } from '../constants';
function
Users
({
dispatch
,
list
:
dataSource
,
loading
,
total
,
page
:
current
})
{
function
deleteHandler
(
id
)
{
console
.
warn
(
`TODO:
${
id
}
`
);
dispatch
({
type
:
'users/remove'
,
payload
:
id
,
});
}
function
pageChangeHandler
(
page
)
{
...
...
src/pages/users/models/users.js
View file @
f12e32bb
...
...
@@ -24,6 +24,11 @@ export default {
},
});
},
*
remove
({
payload
:
id
},
{
call
,
put
,
select
})
{
yield
call
(
usersService
.
remove
,
id
);
const
page
=
yield
select
(
state
=>
state
.
users
.
page
);
yield
put
({
type
:
'fetch'
,
payload
:
{
page
}
});
},
},
subscriptions
:
{
setup
({
dispatch
,
history
})
{
...
...
src/pages/users/services/users.js
View file @
f12e32bb
...
...
@@ -4,3 +4,9 @@ import request from '../../../utils/request';
export
function
fetch
({
page
=
1
})
{
return
request
(
`/api/users?_page=
${
page
}
&_limit=
${
PAGE_SIZE
}
`
);
}
export
function
remove
(
id
)
{
return
request
(
`/api/users/
${
id
}
`
,
{
method
:
'DELETE'
,
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment