Hi from Mafia codes
15 | > 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /packages/client/src/App.css: -------------------------------------------------------------------------------- 1 | .logo { 2 | height: 6em; 3 | padding: 1.5em; 4 | will-change: filter; 5 | } 6 | .logo:hover { 7 | filter: drop-shadow(0 0 2em #646cffaa); 8 | } 9 | .logo.react:hover { 10 | filter: drop-shadow(0 0 2em #61dafbaa); 11 | } 12 | 13 | @keyframes logo-spin { 14 | from { 15 | transform: rotate(0deg); 16 | } 17 | to { 18 | transform: rotate(360deg); 19 | } 20 | } 21 | 22 | @media (prefers-reduced-motion: no-preference) { 23 | a:nth-of-type(2) .logo { 24 | animation: logo-spin infinite 20s linear; 25 | } 26 | } 27 | 28 | .card { 29 | padding: 2em; 30 | } 31 | 32 | .read-the-docs { 33 | color: #888; 34 | } 35 | -------------------------------------------------------------------------------- /packages/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 6 | "allowJs": false, 7 | "skipLibCheck": true, 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "strict": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "module": "ESNext", 13 | "moduleResolution": "Node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react-jsx" 18 | }, 19 | "include": ["src"], 20 | "references": [{ "path": "./tsconfig.node.json" }] 21 | } 22 | -------------------------------------------------------------------------------- /packages/server/src/lib/trpc.ts: -------------------------------------------------------------------------------- 1 | import { inferAsyncReturnType, initTRPC, TRPCError } from '@trpc/server' 2 | import * as trpcExpress from '@trpc/server/adapters/express' 3 | 4 | export const createContext = ({ 5 | req, 6 | res, 7 | }: trpcExpress.CreateExpressContextOptions) => { 8 | // req. 9 | const token = req.headers.authorization 10 | // Validate token 11 | // Get the user 12 | const user = 'Truly' 13 | 14 | const noUser = undefined 15 | 16 | if (user) { 17 | throw new TRPCError({ 18 | code: 'UNAUTHORIZED', 19 | message: 'You are not authorized', 20 | }) 21 | } 22 | 23 | return { 24 | user: user, 25 | } 26 | } 27 | 28 | type Context = inferAsyncReturnType{todo.title}
29 | 30 | 41 | 42 | 70 |