Retain sync setting on reset
After data reset, the sync setting should remain in its previous state (On or Off) instead of always defaulting to Off.
This commit is contained in:
@@ -5,11 +5,13 @@ import { Button } from '@/components/ui/button';
|
||||
import { useAuth } from '@/contexts/auth/AuthProvider';
|
||||
import { useDataReset } from '@/hooks/useDataReset';
|
||||
import DataResetDialog from './DataResetDialog';
|
||||
import { isSyncEnabled } from '@/utils/sync/syncSettings';
|
||||
|
||||
const DataResetSection = () => {
|
||||
const [isResetDialogOpen, setIsResetDialogOpen] = useState(false);
|
||||
const { user } = useAuth();
|
||||
const { isResetting, resetAllData } = useDataReset();
|
||||
const syncEnabled = isSyncEnabled();
|
||||
|
||||
const handleResetAllData = async () => {
|
||||
await resetAllData();
|
||||
@@ -26,7 +28,11 @@ const DataResetSection = () => {
|
||||
<div className="text-left">
|
||||
<h3 className="font-medium">데이터 초기화</h3>
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
{user ? "로컬 및 클라우드의 모든 예산, 지출 내역이 초기화됩니다." : "모든 예산, 지출 내역, 설정이 초기화됩니다."}
|
||||
{user
|
||||
? syncEnabled
|
||||
? "로컬 및 클라우드의 모든 예산, 지출 내역이 초기화됩니다. 동기화 설정은 유지됩니다."
|
||||
: "로컬 및 클라우드의 모든 예산, 지출 내역이 초기화됩니다."
|
||||
: "모든 예산, 지출 내역, 설정이 초기화됩니다."}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,6 +52,7 @@ const DataResetSection = () => {
|
||||
onConfirm={handleResetAllData}
|
||||
isResetting={isResetting}
|
||||
isLoggedIn={!!user}
|
||||
syncEnabled={syncEnabled}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user