Fakultas Ilmu Komputer UI

Commit 7c36af15 authored by Jonathan's avatar Jonathan
Browse files

Merge branch 'jonathan' into 'master'

fix isAdmin in Topic and CreateTopicForm

See merge request !28
parents d739d853 d7dfdba8
......@@ -5,9 +5,12 @@ import '../../styles/topic/CreateTopicForm.css';
import authHeader from '../../helpers/services/authHeader.service';
import { API_URL } from '../../config/keys';
import AuthService from '../../helpers/services/auth.service';
import { loggedIn } from '../../helpers/services/loggedIn.service';
export default function CreateTopicForm(props) {
if (AuthService.getCurrentUser().data.role != "admin") {
const isAdmin = loggedIn ? AuthService.getCurrentUser().data.role : "unregistered";
if (isAdmin != "admin") {
props.history.push("/page/1")
}
......
......@@ -13,7 +13,7 @@ export default function Topic(props) {
const { params } = props.match;
const currentPage = params.pageNumber;
const topicParam = params.topic;
const isAdmin = AuthService.getCurrentUser().data.role
const isAdmin = loggedIn ? AuthService.getCurrentUser().data.role : "unregistered";
const [threads, setThreads] = useState([]);
const [totalItems, setTotalItems] = useState(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment