Skip to content

Commit

Permalink
Format inheritance endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardofano committed Feb 5, 2024
1 parent 119fce2 commit 61f7931
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pages/api/inheritance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { calculateInheritance } from '../../core/inheritance'

export default function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.method !== 'POST') return res.status(405).send({ error: 'Method not allowed' })
if (req.headers['content-type'] !== 'application/json')
if (req.method !== 'POST') {
return res.status(405).send({ error: 'Method not allowed' })
}
if (req.headers['content-type'] !== 'application/json') {
return res.status(400).send({ error: 'Content type not allowed' })
}

// TODO: Don't require sender to set back pointers for people, only the relatives array

try {
const result = calculateInheritance(req.body)
Expand Down

0 comments on commit 61f7931

Please sign in to comment.