fixed reload

This commit is contained in:
Robert 2024-03-08 22:43:35 +07:00
parent 55e22e130e
commit 108e160a63
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -3,6 +3,7 @@ import type { Chain } from "@/entities/chain/schema";
import { useState } from "react";
import { upsertChain } from "@/entities/chain/api/upsert";
import { useChainState } from "@/entities/chain/model";
import { useNavigate } from "@tanstack/react-router";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
@ -20,6 +21,7 @@ export default function RenameChainButton({ chain }: RenameChainButtonProps) {
const [isOpen, setIsOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [isError, setIsError] = useState(false);
const navigate = useNavigate({ from: "/$namespace/$chainId" });
const [chainName, setChainName] = useState(chain.name || "");
const updateChain = useChainState((state) => state.updateChain);
@ -42,6 +44,7 @@ export default function RenameChainButton({ chain }: RenameChainButtonProps) {
if (upsertedChain) {
updateChain(upsertedChain);
navigate({ to: "/$namespace/$chainId" });
setIsOpen(false);
return;
}