Skip to content

Commit

Permalink
No Spectra is shown if user logged out
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Nov 19, 2024
1 parent 7293e22 commit e563c24
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/ImageSelect/ImageSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
/* eslint-disable react/prop-types */
import { Navigate } from "react-router-dom";
import { useAuth } from "react-oidc-context";
import { useEffect, useState } from "react";

export default function ImageSelect({ data, imageSelected, setImageSelected }) {
const auth = useAuth();

const [isAuth, setIsAuth] = useState(false);
// useEffect(() => {
// if (auth.isAuthenticated) setIsAuth(true);
// }, [auth]);

console.log(auth.isAuthenticated);

const renderImageSelect =
data &&
data.map((img, i) => (
Expand Down Expand Up @@ -34,7 +46,7 @@ export default function ImageSelect({ data, imageSelected, setImageSelected }) {
{data && Object.prototype.hasOwnProperty.call(data, "error") && (
<p>Sorry</p>
)}
{data && data.length > 0 ? (
{data && data.length > 0 && auth.isAuthenticated ? (
renderImageSelect
) : (
<div style={{ textAlign: "center" }}>
Expand Down

0 comments on commit e563c24

Please sign in to comment.