Open History to see the last commit
1import { Alert } from 'react-native';
2import type { GlowApi } from '@glow/client';
3
4// Permanent: confirm with the app's name and what disappears with it.
5export function confirmDelete(api: GlowApi, app: { id: string; title: string; posted: boolean }, deleted: () => void, failed: (message: string) => void) {
6 Alert.alert(`Delete ${app.title}?`, `${app.posted ? 'The post comes down for everyone, along with its comments, likes, and plays.' : 'This draft is removed.'} Your chat with Glow and its version history are erased. Remixes other people made stay up. This can't be undone.`, [
7 { text: 'Cancel', style: 'cancel' },
8 { text: 'Delete app', style: 'destructive', onPress: () => { void api.request(`/v1/apps/${app.id}`, undefined, { method: 'DELETE' }).then(deleted).catch(error => failed(error.message)); } },
9 ]);
10}