Roles condition in React render() not rerendering


#1

Hi,

I am trying to render the admin view based on Roles.
The problem is that I when I am authenticated, the render does not change

import React, { Component } from 'react';
import EasyTransition from 'react-easy-transition';
import {Meteor} from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import { Roles } from 'meteor/alanning:roles';

import AccountsUI from './accounts_ui/login_buttons';
import Sidebar from './sidebar';



class AdminApp extends Component {

    render() {
        if (this.props.isAdminUser) {
            return (
                <div>
                    <EasyTransition path={location.pathname}
                                    initialStyle={{opacity: 0}}
                                    transition="opacity 0.3s ease-in"
                                    finalStyle={{opacity: 1}}>
                        <Sidebar/>
                        {this.props.children}
                    </EasyTransition>
                </div>
            )
        }

        if (!this.props.isAdminUser) {
            return (
                <div className="wrapper">
                    <AccountsUI/>
                    <p>You are not admin</p>
                </div>

            )
        }

    }

};

export default createContainer(() => {
    if (Roles.userIsInRole(Meteor.userId(), ['superadmin'], 'backend')) {
       return {isAdminUser: true}
    }
    return {isAdminUser: false}
}, AdminApp)

I am logged in but the render is not changing, what am I missing here?