All files / pages/Admin AdminJobLogPage.js

100% Statements 7/7
100% Branches 2/2
100% Functions 2/2
100% Lines 7/7

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 25 26 27 28 29 30            1x 5x 5x   5x         5x 1x     5x                    
import React from "react";
import { useParams, useNavigate } from "react-router-dom";
import { Button } from "react-bootstrap";
import { useBackend } from "main/utils/useBackend";
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
 
const AdminJobLogPage = () => {
  const { id } = useParams();
  const navigate = useNavigate();
 
  const { data: jobLogs } = useBackend([`/api/jobs/logs/${id}`], {
    method: "GET",
    url: `/api/jobs/logs/${id}`,
  });
 
  const handleBack = () => {
    navigate("/admin/jobs");
  };
 
  return (
    <BasicLayout>
      <Button onClick={handleBack}>Back to Job List</Button>
      <h3>Job Logs for Job {id}</h3>
      {jobLogs ? <pre>{jobLogs}</pre> : <p>Loading...</p>}
    </BasicLayout>
  );
};
 
export default AdminJobLogPage;