Simplify handlers & IPC client: move from Result pattern to throwing errors (#120)
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
} from "@/components/ui/dialog";
|
||||
import { GitHubConnector } from "@/components/GitHubConnector";
|
||||
import { SupabaseConnector } from "@/components/SupabaseConnector";
|
||||
import { showError } from "@/lib/toast";
|
||||
|
||||
export default function AppDetailsPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -62,7 +63,7 @@ export default function AppDetailsPage() {
|
||||
await refreshApps();
|
||||
navigate({ to: "/", search: {} });
|
||||
} catch (error) {
|
||||
console.error("Failed to delete app:", error);
|
||||
showError(error);
|
||||
} finally {
|
||||
setIsDeleting(false);
|
||||
}
|
||||
|
||||
@@ -27,12 +27,8 @@ export default function SettingsPage() {
|
||||
setIsResetting(true);
|
||||
try {
|
||||
const ipcClient = IpcClient.getInstance();
|
||||
const result = await ipcClient.resetAll();
|
||||
if (result.success) {
|
||||
showSuccess("Successfully reset everything. Restart the application.");
|
||||
} else {
|
||||
showError(result.message || "Failed to reset everything.");
|
||||
}
|
||||
await ipcClient.resetAll();
|
||||
showSuccess("Successfully reset everything. Restart the application.");
|
||||
} catch (error) {
|
||||
console.error("Error resetting:", error);
|
||||
showError(
|
||||
|
||||
Reference in New Issue
Block a user