Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit d7dfdba8 authored by Jonathan Chandra's avatar Jonathan Chandra
Browse files

fix isAdmin in Topic and CreateTopicForm

parent d739d853
Branches
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment