(userId: string)
| 21 | const showActionButton = !session || session.user.subscription.plan === "FREE" || expired; |
| 22 | |
| 23 | const refreshQuota = async (userId: string) => { |
| 24 | let quota: Quota = { current: 0, limit: 0 }; |
| 25 | try { |
| 26 | const { data } = await axios.get("/api/usage", { |
| 27 | headers: { Authorization: `Bearer ${userId}` }, |
| 28 | }); |
| 29 | quota = data; |
| 30 | } catch (error) { |
| 31 | // do nth |
| 32 | } |
| 33 | setQuota(quota); |
| 34 | }; |
| 35 | |
| 36 | getEventEmitter().on("usage.update", () => { |
| 37 | if (session?.user.id) { |