Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/dashboard-settin…
Browse files Browse the repository at this point in the history
…gs-page
  • Loading branch information
Adelino Ngomacha committed Jun 6, 2024
2 parents e8e4cb7 + d20fabd commit f964768
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions app/Actions/SubscriberEmailAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ export default new Action({
description: 'Save emails from subscribe page',
method: 'POST',
async handle(request: SubscriberEmailRequestType) {

const email = request.get('email')

const model = await SubscriberEmail.create({ email })

return model
},
})
})
10 changes: 5 additions & 5 deletions storage/framework/core/router/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,19 @@ async function execute(foundRoute: Route, req: Request, { statusCode }: Options)
}

if (isString(foundCallback)) return await new Response(foundCallback, {
headers: { 'Accept': 'application/json', 'Content-Type': 'json' }
headers: { 'Content-Type': 'json', }, status: 200
}
)

if (isFunction(foundCallback)) {
const result = foundCallback()

return await new Response(JSON.stringify(result))
return await new Response(JSON.stringify(result), { status: 200 })
}

if (isObject(foundCallback)) return await new Response(JSON.stringify(foundCallback), {
headers: { 'Accept': 'application/json', 'Content-Type': 'json' }
})
if (isObject(foundCallback))
return await new Response(JSON.stringify(foundCallback),
{ headers: { 'Content-Type': 'json' }, status: 200 })

// If no known type matched, return a generic error.
return await new Response('Unknown callback type.', { status: 500 })
Expand Down

0 comments on commit f964768

Please sign in to comment.