| 1 | import { headers } from 'next/headers' |
| 2 | import { createSafeActionClient } |
| 3 | import { getSession } |
| 4 | import { roles } |
| 5 | import { authClient } |
| 6 | |
| 7 | export const actionClient = |
| 8 | handleServerError(error) { |
| 9 | return error.message |
| 10 | }, |
| 11 | }) |
| 12 | |
| 13 | export const authedActionClient = |
| 14 | const session = |
| 15 | if (!session) |
| 16 | throw new Error( |
| 17 | } |
| 18 | |
| 19 | const member = |
| 20 | fetchOptions: { headers: await |
| 21 | }) |
| 22 | |
| 23 | if (!member.data |
| 24 | throw new Error( |
| 25 | } |
| 26 | |
| 27 | const role = |
| 28 | |
| 29 | return next({ |
| 30 | ctx: { |
| 31 | user: session.user |
| 32 | session: session.session |
| 33 | orgMember: member.data |
| 34 | role, |
| 35 | }, |
| 36 | }) |
| 37 | }) |