feat: update profile and thought handling with token validation and router refresh
Some checks failed
test / unit (push) Has been cancelled
lint / lint (push) Has been cancelled

This commit is contained in:
2026-07-04 15:31:58 +02:00
parent c22bc68a8b
commit 052d8c67bb
3 changed files with 15 additions and 9 deletions

View File

@@ -20,13 +20,13 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { CreateThoughtSchema, type Me } from "@/lib/api";
import { CreateThoughtSchema, createThought, type Me } from "@/lib/api";
import { useAuth } from "@/hooks/use-auth";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import { Globe, Lock, Users } from "lucide-react";
import { useState } from "react";
import { Confetti } from "./confetti";
import { createThought } from "@/app/actions/thoughts";
const DEFAULT_MOODS = [
"relaxed 😌",
@@ -68,6 +68,7 @@ export function ThoughtForm({
currentUser,
}: ThoughtFormProps) {
const { token } = useAuth();
const router = useRouter();
const [showConfetti, setShowConfetti] = useState(false);
const allMoods = [
@@ -97,7 +98,8 @@ export function ThoughtForm({
return;
}
try {
await createThought(values);
await createThought(values, token);
router.refresh();
toast.success(replyToId ? "Reply posted!" : "Thought posted!");
setShowConfetti(true);
form.reset();