[slug].tsx36 lines · main
| 1 | import { NextApiRequest, NextApiResponse } from 'next' |
| 2 | |
| 3 | import apiWrapper from '@/lib/api/apiWrapper' |
| 4 | |
| 5 | export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) |
| 6 | |
| 7 | async function handler(req: NextApiRequest, res: NextApiResponse) { |
| 8 | const { method } = req |
| 9 | |
| 10 | switch (method) { |
| 11 | case 'GET': |
| 12 | return handleGetAll(req, res) |
| 13 | default: |
| 14 | res.setHeader('Allow', ['GET']) |
| 15 | res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } }) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | const handleGetAll = async (_req: NextApiRequest, res: NextApiResponse) => { |
| 20 | // Platform specific endpoint |
| 21 | const response = { |
| 22 | members: [], |
| 23 | products: [], |
| 24 | customer: { |
| 25 | customer: {}, |
| 26 | subscriptions: {}, |
| 27 | total_paid_projects: 0, |
| 28 | total_free_projects: 0, |
| 29 | total_pro_projects: 0, |
| 30 | total_team_projects: 0, |
| 31 | total_payg_projects: 0, |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | return res.status(200).json(response) |
| 36 | } |