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