Fakultas Ilmu Komputer UI

Commit d7dfdba8 authored by Jonathan Chandra's avatar Jonathan Chandra
Browse files

fix isAdmin in Topic and CreateTopicForm

parent d739d853
......@@ -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);
......
Supports Markdown
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