Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import { isAdmin } from '/imports/api/users/helpers.js';
  2. import { browserHistory } from 'react-router';
  3. import React, { PropTypes } from 'react';
  4. import { Meteor } from 'meteor/meteor';
  5. import { banUser } from './methods';
  6.  
  7.  
  8. import {
  9. Card,
  10. CardActions,
  11. CardTitle,
  12. RaisedButton,
  13. } from 'material-ui';
  14.  
  15.  
  16. const funk = () => {
  17. console.log(Meteor.user().isAdmin);
  18. banUser();
  19. };
  20.  
  21.  
  22. const Panel = () => {
  23.  
  24. const admin = isAdmin();
  25. if (admin !== 'loading') {
  26. if (admin) {
  27. console.log('is admin', admin);
  28. } else {
  29. console.log('is not admin', admin);
  30. return (
  31. browserHistory.push('/project')
  32. );
  33. }
  34. }
  35.  
  36. return (
  37. <Card>
  38. <CardTitle
  39. title="Retro Tool- Admin Panel"
  40. subtitle="Admin"
  41. />
  42.  
  43. <CardActions>
  44. <RaisedButton
  45. label="Check if you are admin"
  46. onClick={funk}
  47. fullWidth
  48. />
  49. </CardActions>
  50. </Card>
  51. );
  52. };
  53.  
  54. export default Panel;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement