update
This commit is contained in:
@@ -6,8 +6,10 @@ import { useRouter } from 'expo-router';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { usePresetStore } from '@store/presetStore';
|
||||
import { useAuthStore } from '@store/authStore';
|
||||
import { isUserOwnedPreset } from '@domain/SpoolPreset';
|
||||
import { colors, typography, spacing, radius } from '@shared/theme';
|
||||
import { deletePresetUseCase } from '@infrastructure/container';
|
||||
|
||||
/**
|
||||
* Tela de Presets de Carretéis — M4-0
|
||||
@@ -22,7 +24,23 @@ export default function ConfigScreen(): React.ReactElement {
|
||||
`Deseja excluir o preset "${name}"?`,
|
||||
[
|
||||
{ text: 'Cancelar', style: 'cancel' },
|
||||
{ text: 'Excluir', style: 'destructive', onPress: () => removePreset(id) },
|
||||
{
|
||||
text: 'Excluir',
|
||||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
try {
|
||||
const user = useAuthStore.getState().user;
|
||||
if (!user) {
|
||||
Alert.alert('Erro', 'Usuário não autenticado');
|
||||
return;
|
||||
}
|
||||
await deletePresetUseCase.execute(id, user.id);
|
||||
removePreset(id);
|
||||
} catch (error) {
|
||||
Alert.alert('Erro', `Falha ao deletar: ${(error as Error).message}`);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user