sync then reload setting

This commit is contained in:
Gabe Yuan
2023-09-01 10:15:57 +08:00
parent 732a526a8e
commit b14a38e4fb
4 changed files with 26 additions and 17 deletions

View File

@@ -12,12 +12,14 @@ import Button from "@mui/material/Button";
import { useAlert } from "../../hooks/Alert";
import SyncIcon from "@mui/icons-material/Sync";
import CircularProgress from "@mui/material/CircularProgress";
import { useSetting } from "../../hooks/Setting";
export default function SyncSetting() {
const i18n = useI18n();
const { sync, updateSync } = useSync();
const alert = useAlert();
const [loading, setLoading] = useState(false);
const { reloadSetting } = useSetting();
const handleChange = async (e) => {
e.preventDefault();
@@ -32,6 +34,7 @@ export default function SyncSetting() {
try {
setLoading(true);
await syncSettingAndRules();
await reloadSetting();
alert.success(i18n("data_sync_success"));
} catch (err) {
console.log("[sync all]", err);