mirror of
https://github.com/Since-3/Kuma.git
synced 2026-10-12 21:41:17 +00:00
see comments
This commit is contained in:
parent
9011c4699e
commit
219b3e4cf2
4 changed files with 9 additions and 9 deletions
|
|
@ -1,10 +1,8 @@
|
|||
import { Suspense } from "react";
|
||||
import { requireManager } from "@/src/lib/auth/getUser";
|
||||
import SettingsBusinessPageView from "@/src/modules/settings/ui/views/settings-business-page-view";
|
||||
import SettingsLoading from "../loading";
|
||||
|
||||
export default async function SettingsBusinessPage() {
|
||||
await requireManager();
|
||||
export default function SettingsBusinessPage() {
|
||||
return (
|
||||
<Suspense fallback={<SettingsLoading />}>
|
||||
<SettingsBusinessPageView />
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { Suspense } from "react";
|
||||
import { requireAuthWithData } from "@/src/lib/auth/getUser";
|
||||
import SettingsPersonalPageView from "@/src/modules/settings/ui/views/settings-personal-page-view";
|
||||
import SettingsLoading from "../loading";
|
||||
|
||||
export default async function SettingsPersonalPage() {
|
||||
await requireAuthWithData();
|
||||
export default function SettingsPersonalPage() {
|
||||
return (
|
||||
<Suspense fallback={<SettingsLoading />}>
|
||||
<SettingsPersonalPageView />
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { deleteCourse } from "../actions/course-actions";
|
|||
import { toast } from "sonner";
|
||||
|
||||
interface UseDeleteCourseOptions {
|
||||
onSuccess?: () => void;
|
||||
onSuccess?: (deletedId: string) => void;
|
||||
}
|
||||
|
||||
export function useDeleteCourse({ onSuccess }: UseDeleteCourseOptions = {}) {
|
||||
|
|
@ -27,8 +27,9 @@ export function useDeleteCourse({ onSuccess }: UseDeleteCourseOptions = {}) {
|
|||
|
||||
if (result.success) {
|
||||
toast.success(result.message);
|
||||
const deletedId = courseToDelete.id;
|
||||
setCourseToDelete(null);
|
||||
onSuccess?.();
|
||||
onSuccess?.(deletedId);
|
||||
} else {
|
||||
setCourseToDelete(null);
|
||||
toast.error(result.error || "Fehler beim Löschen des Kurses");
|
||||
|
|
|
|||
|
|
@ -87,7 +87,10 @@ const CourseListView = ({
|
|||
handleDeleteClick,
|
||||
handleDeleteConfirm,
|
||||
} = useDeleteCourse({
|
||||
onSuccess: () => router.refresh(),
|
||||
onSuccess: (deletedId) => {
|
||||
setCourses((prev) => prev.filter((c) => c.id !== deletedId));
|
||||
router.refresh();
|
||||
},
|
||||
});
|
||||
|
||||
const loadCourses = async (options: { dateFrom: Date; dateTo: Date }) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue