Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/features/admin/programs/ui/add-session-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { Badge } from "@/components/ui/badge";

import { addSessionToWeek } from "../actions/add-session.action";

import { useRouter } from "next/navigation";

const sessionSchema = z.object({
title: z.string().min(1, "Le titre est requis"),
titleEn: z.string().min(1, "Le titre en anglais est requis"),
Expand Down Expand Up @@ -44,6 +46,7 @@ interface AddSessionModalProps {
nextSessionNumber: number;
}

const router = useRouter();
const EQUIPMENT_OPTIONS = [
{ value: ExerciseAttributeValueEnum.BODY_ONLY, label: "Poids du corps" },
{ value: ExerciseAttributeValueEnum.DUMBBELL, label: "Haltères" },
Expand Down Expand Up @@ -118,7 +121,7 @@ export function AddSessionModal({ open, onOpenChange, weekId, nextSessionNumber
reset();
setSelectedEquipment([]);
onOpenChange(false);
window.location.reload(); // Refresh to show new session
router.refresh(); // Refresh to show new session
} catch (error) {
console.error("Error adding session:", error);
alert("Erreur lors de l'ajout de la séance");
Expand Down
6 changes: 5 additions & 1 deletion src/features/admin/programs/ui/add-week-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { X } from "lucide-react";

import { addWeekToProgram } from "../actions/add-week.action";

import { useRouter } from "next/navigation";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const weekSchema = z.object({
title: z.string().min(1, "Le titre est requis"),
Expand All @@ -22,6 +24,8 @@ const weekSchema = z.object({
descriptionZhCn: z.string().optional(),
});

const router = useRouter();

type WeekFormData = z.infer<typeof weekSchema>;

interface AddWeekModalProps {
Expand Down Expand Up @@ -60,7 +64,7 @@ export function AddWeekModal({ open, onOpenChange, programId, nextWeekNumber }:
});

onOpenChange(false);
window.location.reload(); // Refresh to show new week
router.refresh(); // Refresh to show new week
} catch (error) {
console.error("Error adding week:", error);
alert("Erreur lors de l'ajout de la semaine");
Expand Down
5 changes: 4 additions & 1 deletion src/features/admin/programs/ui/create-program-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { useState } from "react";
import { CheckCircle } from "lucide-react";

import { CreateProgramForm } from "./create-program-form";
import { useRouter } from "next/navigation";

interface CreateProgramModalProps {
open: boolean;
onOpenChange: (open: boolean) => void;
}

const router = useRouter();

const STEPS = [
{ id: 1, title: "Informations générales", description: "Titre, description, niveau..." },
{ id: 2, title: "Configuration", description: "Durée, fréquence, équipement..." },
Expand Down Expand Up @@ -40,7 +43,7 @@ export function CreateProgramModal({ open, onOpenChange }: CreateProgramModalPro
const handleSuccess = () => {
handleClose();
// Refresh the page to show the new program
window.location.reload();
router.refresh();
};

return (
Expand Down
4 changes: 3 additions & 1 deletion src/features/auth/signup/model/useSignUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { useI18n } from "locales/client";
import { SignUpSchema } from "@/features/auth/signup/schema/signup.schema";
import { signUpAction } from "@/features/auth/signup/model/signup.action";
import { brandedToast } from "@/components/ui/toast";
import { useRouter } from "next/navigation";

export const useSignUp = () => {
const t = useI18n();
const router = useRouter();
const searchParams = useSearchParams();

const mutation = useMutation({
Expand All @@ -30,7 +32,7 @@ export const useSignUp = () => {
onSuccess: async () => {
const redirectUrl = searchParams.get("redirect");
const destination = redirectUrl || "/profile";
window.location.href = destination;
router.push(destination);
// router.push(`/${paths.verifyEmail}?signin=true`);
},

Expand Down
Loading