fix(StoreApiKeyModal/index.tsx): fix typo in import statement for StoreContext
feat(StoreApiKeyModal/index.tsx): add support for checking if an API key exists in the StoreContext fix(market-card.tsx): remove unnecessary code for handling installable market cards
This commit is contained in:
parent
bc9f3f20d8
commit
58e5c179a0
2 changed files with 4 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import { Input } from "../../components/ui/input";
|
||||||
import { CONTROL_NEW_API_KEY } from "../../constants/constants";
|
import { CONTROL_NEW_API_KEY } from "../../constants/constants";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
import { alertContext } from "../../contexts/alertContext";
|
||||||
import { AuthContext } from "../../contexts/authContext";
|
import { AuthContext } from "../../contexts/authContext";
|
||||||
|
import { StoreContext } from "../../contexts/storeContext";
|
||||||
import { addApiKeyStore } from "../../controllers/API";
|
import { addApiKeyStore } from "../../controllers/API";
|
||||||
import {
|
import {
|
||||||
ApiKeyInputType,
|
ApiKeyInputType,
|
||||||
|
|
@ -25,6 +26,7 @@ export default function StoreApiKeyModal({
|
||||||
const { setSuccessData, setErrorData } = useContext(alertContext);
|
const { setSuccessData, setErrorData } = useContext(alertContext);
|
||||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||||
const { storeApiKey } = useContext(AuthContext);
|
const { storeApiKey } = useContext(AuthContext);
|
||||||
|
const { hasApiKey } = useContext(StoreContext);
|
||||||
|
|
||||||
function handleInput({
|
function handleInput({
|
||||||
target: { name, value },
|
target: { name, value },
|
||||||
|
|
@ -86,6 +88,8 @@ export default function StoreApiKeyModal({
|
||||||
<div className="flex items-center justify-between gap-2">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<Form.Control asChild>
|
<Form.Control asChild>
|
||||||
<Input
|
<Input
|
||||||
|
//fake api key
|
||||||
|
value={hasApiKey ? "this is not a real api key :)" : ""}
|
||||||
type="password"
|
type="password"
|
||||||
onChange={({ target: { value } }) => {
|
onChange={({ target: { value } }) => {
|
||||||
handleInput({ target: { name: "apikey", value } });
|
handleInput({ target: { name: "apikey", value } });
|
||||||
|
|
|
||||||
|
|
@ -238,8 +238,6 @@ export const MarketCardComponent = ({
|
||||||
}
|
}
|
||||||
if (!added) {
|
if (!added) {
|
||||||
handleAdd();
|
handleAdd();
|
||||||
} else if (installable) {
|
|
||||||
handleInstall();
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue