Skip to content

Commit

Permalink
fix: removed unneccessary verification
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Apr 18, 2024
1 parent 46b4ac6 commit 426e8e6
Showing 1 changed file with 46 additions and 47 deletions.
93 changes: 46 additions & 47 deletions src/components/manage-productions/manage-productions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export const ManageProductions = () => {
.catch((error) => {
dispatch({
type: "ERROR",
payload: error instanceof Error ? error : new Error("Failed to delete production"),
payload:
error instanceof Error
? error
: new Error("Failed to delete production"),
});
setLoading(false);
});
Expand Down Expand Up @@ -139,52 +142,48 @@ export const ManageProductions = () => {
as={StyledWarningMessage}
/>
{production ? (
production && (
<>
<DecorativeLabel>
Production name: {production.name}
</DecorativeLabel>
{!verifyRemove && (
<ActionButton
type="submit"
className={loading ? "submit" : ""}
onClick={() => setVerifyRemove(true)}
>
Remove
{loading && <Spinner className="create-production" />}
</ActionButton>
)}
{verifyRemove && (
<VerifyBtnWrapper>
<p>Are you sure?</p>
<VerifyButtons>
<Button
type="submit"
className={loading ? "submit" : ""}
onClick={handleSubmit(onSubmit)}
>
Yes
{loading && <Spinner className="create-production" />}
</Button>
<Button
type="submit"
className={loading ? "submit" : ""}
onClick={() => {
setRemoveProductionId(null);
setVerifyRemove(false);
reset({
productionId: "",
});
}}
>
Go back
{loading && <Spinner className="create-production" />}
</Button>
</VerifyButtons>
</VerifyBtnWrapper>
)}
</>
)
<>
<DecorativeLabel>Production name: {production.name}</DecorativeLabel>
{!verifyRemove && (
<ActionButton
type="submit"
className={loading ? "submit" : ""}
onClick={() => setVerifyRemove(true)}
>
Remove
{loading && <Spinner className="create-production" />}
</ActionButton>
)}
{verifyRemove && (
<VerifyBtnWrapper>
<p>Are you sure?</p>
<VerifyButtons>
<Button
type="submit"
className={loading ? "submit" : ""}
onClick={handleSubmit(onSubmit)}
>
Yes
{loading && <Spinner className="create-production" />}
</Button>
<Button
type="submit"
className={loading ? "submit" : ""}
onClick={() => {
setRemoveProductionId(null);
setVerifyRemove(false);
reset({
productionId: "",
});
}}
>
Go back
{loading && <Spinner className="create-production" />}
</Button>
</VerifyButtons>
</VerifyBtnWrapper>
)}
</>
) : (
<StyledWarningMessage>
Please enter a production id
Expand Down

0 comments on commit 426e8e6

Please sign in to comment.