Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { isAdmin } from '/imports/api/users/helpers.js';
- import { browserHistory } from 'react-router';
- import React, { PropTypes } from 'react';
- import { Meteor } from 'meteor/meteor';
- import { banUser } from './methods';
- import {
- Card,
- CardActions,
- CardTitle,
- RaisedButton,
- } from 'material-ui';
- const funk = () => {
- console.log(Meteor.user().isAdmin);
- banUser();
- };
- const Panel = () => {
- const admin = isAdmin();
- if (admin !== 'loading') {
- if (admin) {
- console.log('is admin', admin);
- } else {
- console.log('is not admin', admin);
- return (
- browserHistory.push('/project')
- );
- }
- }
- return (
- <Card>
- <CardTitle
- title="Retro Tool- Admin Panel"
- subtitle="Admin"
- />
- <CardActions>
- <RaisedButton
- label="Check if you are admin"
- onClick={funk}
- fullWidth
- />
- </CardActions>
- </Card>
- );
- };
- export default Panel;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement