2017-06-17 15:25:41 +09:00
|
|
|
import React from 'react';
|
|
|
|
import Users from 'meteor/vulcan:users';
|
|
|
|
import { Components, withRemove } from 'meteor/vulcan:core';
|
|
|
|
|
2017-08-02 16:19:15 +09:00
|
|
|
const AdminUsersActions = ({ document: user, removeMutation }) =>{
|
2017-06-17 15:25:41 +09:00
|
|
|
|
|
|
|
const deleteHandler = e => {
|
|
|
|
e.preventDefault();
|
|
|
|
if (confirm(`Delete user ${Users.getDisplayName(user)}?`)) {
|
|
|
|
removeMutation({documentId: user._id});
|
|
|
|
}
|
2018-12-31 15:22:17 +09:00
|
|
|
};
|
2017-06-17 15:25:41 +09:00
|
|
|
|
2018-12-31 15:22:17 +09:00
|
|
|
return <Components.Button variant="primary" onClick={deleteHandler}>Delete</Components.Button>;
|
|
|
|
};
|
2017-06-17 15:25:41 +09:00
|
|
|
|
|
|
|
const removeOptions = {
|
|
|
|
collection: Users
|
2018-12-31 15:22:17 +09:00
|
|
|
};
|
2017-06-17 15:25:41 +09:00
|
|
|
|
|
|
|
export default withRemove(removeOptions)(AdminUsersActions);
|
|
|
|
|