mirror of
https://github.com/aljazceru/goose.git
synced 2026-01-08 08:54:22 +01:00
feat: Better messages for extension enable/disable/remove (#784)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { ScrollArea } from '../ui/scroll-area';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { Settings as SettingsType } from './types';
|
||||
import {
|
||||
FullExtensionConfig,
|
||||
@@ -132,9 +132,11 @@ export default function Settings() {
|
||||
const handleExtensionRemove = async () => {
|
||||
if (!extensionBeingConfigured) return;
|
||||
|
||||
const response = await removeExtension(extensionBeingConfigured.name);
|
||||
const response = await removeExtension(extensionBeingConfigured.name, true);
|
||||
|
||||
if (response.ok) {
|
||||
toast.success(`Successfully removed ${extensionBeingConfigured.name} extension`);
|
||||
|
||||
// Remove from localstorage
|
||||
setSettings((prev) => ({
|
||||
...prev,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getApiUrl, getSecretKey } from './config';
|
||||
import { NavigateFunction } from 'react-router-dom';
|
||||
import { toast } from 'react-toastify';
|
||||
import { getStoredProvider } from './utils/providerUtils';
|
||||
|
||||
// ExtensionConfig type matching the Rust version
|
||||
export type ExtensionConfig =
|
||||
@@ -128,7 +127,7 @@ export async function addExtension(
|
||||
|
||||
if (!data.error) {
|
||||
if (!silent) {
|
||||
toast.success(`Successfully added extension`);
|
||||
toast.success(`Successfully enabled ${extension.name} extension`);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -145,7 +144,7 @@ export async function addExtension(
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeExtension(name: string): Promise<Response> {
|
||||
export async function removeExtension(name: string, silent: boolean = false): Promise<Response> {
|
||||
try {
|
||||
const response = await fetch(getApiUrl('/extensions/remove'), {
|
||||
method: 'POST',
|
||||
@@ -159,7 +158,9 @@ export async function removeExtension(name: string): Promise<Response> {
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.error) {
|
||||
toast.success(`Successfully removed ${name} extension`);
|
||||
if (!silent) {
|
||||
toast.success(`Successfully disabled ${name} extension`);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user