Profile Page
12 |ID: {user?.id}
14 |Name: {user?.name}
15 |Email: {user?.email}
16 |Role: {user?.role}
17 |39 | {errors[name]?.message as string} 40 |
41 |82 | {errors[name] && (errors[name]?.message as string)} 83 |
84 | > 85 | )} 86 | /> 87 | ); 88 | }; 89 | 90 | export default FileUpLoader; 91 | -------------------------------------------------------------------------------- /packages/client/src/components/Header.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import { useQueryClient } from "@tanstack/react-query"; 3 | import { Link } from "react-router-dom"; 4 | import useStore from "../store"; 5 | import { trpc } from "../trpc"; 6 | import PostModal from "./modals/post.modal"; 7 | import CreatePost from "./posts/create.post"; 8 | import Spinner from "./Spinner"; 9 | 10 | const Header = () => { 11 | const [openPostModal, setOpenPostModal] = useState(false); 12 | const store = useStore(); 13 | const user = store.authUser; 14 | 15 | const queryClient = useQueryClient(); 16 | const { mutate: logoutUser } = trpc.logoutUser.useMutation({ 17 | onSuccess(data) { 18 | queryClient.clear(); 19 | document.location.href = "/login"; 20 | }, 21 | onError(error) { 22 | queryClient.clear(); 23 | document.location.href = "/login"; 24 | }, 25 | }); 26 | 27 | const handleLogout = () => { 28 | logoutUser(); 29 | }; 30 | 31 | return ( 32 | <> 33 |{post.category}
77 |78 | {format(parseISO(post.createdAt), "PPP")} 79 |
80 |{post.user.name}
92 |