All files / pages Moderate.js

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24          1x 9x   9x 6x     3x                      
import React from "react";
import { useCurrentUser, hasRole } from "main/utils/currentUser";
import { Navigate } from "react-router-dom";
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
 
const Moderate = () => {
  const { data: currentUser } = useCurrentUser();
 
  if (!currentUser.loggedIn || !hasRole(currentUser, "ROLE_ADMIN")) {
    return <Navigate to="/" />;
  }
 
  return (
    <BasicLayout>
      <div className="pt-2">
        <h1>Moderation Page</h1>
        <p>This page is accessible only to admins. (Placeholder)</p>
      </div>
    </BasicLayout>
  );
};
 
export default Moderate;