mirror of
https://github.com/allankoechke/mantisbase-admin.git
synced 2026-11-30 10:19:37 +00:00
Updated toast display
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}`,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user