Updated toast display

This commit is contained in:
2025-08-14 01:01:44 +03:00
parent 925da2ecff
commit 595a6d08f6
10 changed files with 13 additions and 19 deletions

View File

@@ -61,9 +61,10 @@ export function AdminDashboard({ token, onLogout }: AdminDashboardProps) {
}
toast({
variant: type === "error" ? "default" : "destructive",
variant: type === "error" ? "destructive" : "default",
title: type === "error" ? "Error" : "Warning",
description: error,
duration: 10000,
})
} catch (toastError) {
console.warn("Failed to show error toast:", toastError)

View File

@@ -117,9 +117,9 @@ export function AdminsSection({ admins, apiClient, onAdminsUpdate }: AdminsSecti
onAdminsUpdate(updatedAdmins)
toast({
variant: "destructive",
title: "Admin Deleted",
description: "Admin account deleted successfully!",
duration: 3000,
})
} catch (error) {
console.error("Failed to delete admin:", error)

View File

@@ -49,9 +49,9 @@ export function ChangePasswordDialog({ admin, apiClient, onClose }: ChangePasswo
onClose()
toast({
variant: "destructive",
title: "Admin Updated",
description: "Admin account password updated successfully!",
duration: 3000,
})
} catch (error) {
setError("Failed to change password")

View File

@@ -95,9 +95,9 @@ export function AddItemDrawer({ table, apiClient, open, onClose, onItemAdded }:
onClose()
toast({
variant: "destructive",
title: "Table Created",
description: `A table ${table.name} has been created successfully.`,
title: "Table Record Created",
description: `The record was created successfully.`,
duration: 3000,
})
} catch (error) {
console.error("Failed to update item:", error)

View File

@@ -170,8 +170,7 @@ export function AddTableDialog({ apiClient, onTablesUpdate, children }: AddTable
setOpen(false)
toast({
variant: "destructive",
title: "Table Created",
title: "Table Updated",
description: `The table '${tableData.name}' been updated successfully.`,
})
} catch (error) {

View File

@@ -63,9 +63,9 @@ export function DatabaseSection({ apiClient, tables, onTablesUpdate }: DatabaseS
onTablesUpdate(updatedTables)
toast({
variant: "destructive",
title: "Table Deleted",
description: "Table deleted successfully!",
duration: 3000,
})
} catch (error) {
console.error("Failed to delete table:", error)

View File

@@ -57,9 +57,9 @@ export function EditItemDrawer({ table, item, apiClient, open, onClose, onItemUp
onClose()
toast({
variant: "destructive",
title: "Table Updated",
description: "Table data has been updated successfully.",
duration: 3000,
})
} catch (error) {
console.error("Failed to update item:", error)

View File

@@ -132,9 +132,9 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda
onTableUpdate(updatedTable)
toast({
variant: "destructive",
title: "Table Updated",
description: "Table fields updated successfully.",
duration: 3000,
})
} catch (error) {
console.error("Failed to update schema:", error)
@@ -163,9 +163,9 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda
onTableUpdate(updatedTable)
toast({
variant: "destructive",
title: "Table Updated",
description: "Table access rules updated successfully!",
duration: 3000,
})
} catch (error) {
console.error("Failed to update rules:", error)

View File

@@ -74,9 +74,9 @@ export function SettingsSection({ apiClient, settings, onSettingsUpdate, onModeC
setHasChanges(false)
toast({
variant: "destructive",
title: "Settings Saved",
description: "Application settings have been updated successfully.",
duration: 3000,
})
} catch (error) {
console.error("Failed to update settings:", error)

View File

@@ -107,12 +107,6 @@ export class ApiClient {
private async realApiCall<T>(endpoint: string, options: RequestInit = {}): Promise<ApiResponse<T>> {
try {
const url = `${getApiBaseUrl()}${endpoint}`
// const headers = {
// "Content-Type": "application/json",
// Authorization: `Bearer ${this.token}`,
// ...options.headers,
// }
const headers: Record<string, string> = {
Authorization: `Bearer ${this.token}`,
};