🐛 fix(headerComponent): fix rendering issue with API keys button when autoLogin is true

 feat(headerComponent): add condition to render API keys button only when autoLogin is false
This commit is contained in:
Cristhian Zanforlin Lousa 2023-08-17 19:06:05 -03:00
commit 151bbc24d2

View file

@ -18,13 +18,11 @@ export default function Header() {
const { dark, setDark } = useContext(darkContext);
const { notificationCenter } = useContext(alertContext);
const location = useLocation();
const { logout, autoLogin } = useContext(AuthContext);
const { logout, autoLogin, isAdmin, setIsAdmin } = useContext(AuthContext);
const navigate = useNavigate();
const [stars, setStars] = useState(null);
const { isAdmin, setIsAdmin } = useContext(AuthContext);
// Get and set numbers of stars on header
useEffect(() => {
async function fetchStars() {
@ -141,16 +139,18 @@ export default function Header() {
/>
</div>
</AlertDropdown>
<button
onClick={() => {
navigate("/account/api-keys");
}}
>
<IconComponent
name="Key"
className="side-bar-button-size text-muted-foreground hover:text-accent-foreground"
/>
</button>
{!autoLogin && (
<button
onClick={() => {
navigate("/account/api-keys");
}}
>
<IconComponent
name="Key"
className="side-bar-button-size text-muted-foreground hover:text-accent-foreground"
/>
</button>
)}
</div>
</div>
</div>