Fix API key management and heart and add buttons
This commit is contained in:
parent
719a39a75b
commit
f829ec735c
4 changed files with 8 additions and 7 deletions
|
|
@ -251,7 +251,7 @@ export default function CollectionCardComponent({
|
||||||
content={authorized ? "Like" : "Please review your API key."}
|
content={authorized ? "Like" : "Please review your API key."}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
disabled={loadingLike || !authorized}
|
disabled={loadingLike}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="xs"
|
size="xs"
|
||||||
className={
|
className={
|
||||||
|
|
@ -282,11 +282,13 @@ export default function CollectionCardComponent({
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={loading}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="xs"
|
size="xs"
|
||||||
className={
|
className={
|
||||||
"whitespace-nowrap" +
|
"whitespace-nowrap" +
|
||||||
(!authorized ? " cursor-not-allowed" : "")
|
(!authorized ? " cursor-not-allowed" : "") +
|
||||||
|
(!loading ? " p-0.5" : "")
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (loading || !authorized) {
|
if (loading || !authorized) {
|
||||||
|
|
@ -298,7 +300,7 @@ export default function CollectionCardComponent({
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name={loading ? "Loader2" : "Plus"}
|
name={loading ? "Loader2" : "Plus"}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
loading ? "h-5 w-5 animate-spin" : "h-6 w-6 p-0.5",
|
loading ? "h-5 w-5 animate-spin" : "h-6 w-6",
|
||||||
!authorized ? " text-ring" : ""
|
!authorized ? " text-ring" : ""
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export function StoreProvider({ children }) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchApiData();
|
fetchApiData();
|
||||||
}, [storeChecked, validApiKey, apiKey]);
|
}, [storeChecked, apiKey]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StoreContext.Provider
|
<StoreContext.Provider
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default function StoreApiKeyModal({ children }: StoreApiKeyType) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const { setSuccessData, setErrorData } = useContext(alertContext);
|
const { setSuccessData, setErrorData } = useContext(alertContext);
|
||||||
const { storeApiKey } = useContext(AuthContext);
|
const { storeApiKey } = useContext(AuthContext);
|
||||||
const { hasApiKey, setHasApiKey, validApiKey } = useContext(StoreContext);
|
const { hasApiKey, validApiKey } = useContext(StoreContext);
|
||||||
const [apiKeyValue, setApiKeyValue] = useState("");
|
const [apiKeyValue, setApiKeyValue] = useState("");
|
||||||
|
|
||||||
const handleSaveKey = () => {
|
const handleSaveKey = () => {
|
||||||
|
|
@ -25,7 +25,6 @@ export default function StoreApiKeyModal({ children }: StoreApiKeyType) {
|
||||||
title: "Success! Your API Key has been saved.",
|
title: "Success! Your API Key has been saved.",
|
||||||
});
|
});
|
||||||
storeApiKey(apiKeyValue);
|
storeApiKey(apiKeyValue);
|
||||||
setHasApiKey(true);
|
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ export default function StorePage(): JSX.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleGetComponents() {
|
function handleGetComponents() {
|
||||||
if (!hasApiKey) return;
|
if (!hasApiKey || loadingApiKey) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
getStoreComponents({
|
getStoreComponents({
|
||||||
page: pageIndex,
|
page: pageIndex,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue