Skip to content

Commit

Permalink
Merge pull request #24 from olivertsesk/bugfix/prof2admin
Browse files Browse the repository at this point in the history
Bugfix for any logged-in user being able to navigate to admin page
  • Loading branch information
MrCerealKiller authored Mar 29, 2018
2 parents 71275be + 456daaa commit 9de0f85
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bodies/adminLanding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import React, { Component } from 'react';
import { Col } from 'react-bootstrap';
import * as firebase from "firebase";
import * as firebase from 'firebase';

import ClassList from './components/adminListing';

Expand All @@ -23,6 +23,17 @@ class AdminLanding extends Component {
}

componentDidMount() {
const adminID = "stpX94g415buRPBTRLCl9jKnbbU2"
firebase.auth().onAuthStateChanged((user) => {
if (user) {
if (adminID != user.uid) {
this.props.history.push('/prof/');
}
} else {
this.props.history.push('/main');
}
});

window.addEventListener('resize', this.resize);
firebase.database().ref('/classes/').on('value',(snapshot) =>{
var classes =[];
Expand Down

0 comments on commit 9de0f85

Please sign in to comment.