diff --git a/app/Actions/SubscriberEmailAction.ts b/app/Actions/SubscriberEmailAction.ts index 3a22bd2a0c..084d4a4707 100644 --- a/app/Actions/SubscriberEmailAction.ts +++ b/app/Actions/SubscriberEmailAction.ts @@ -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 }, -}) +}) \ No newline at end of file diff --git a/storage/framework/core/router/src/server.ts b/storage/framework/core/router/src/server.ts index 888b33d218..27749d8ce6 100644 --- a/storage/framework/core/router/src/server.ts +++ b/storage/framework/core/router/src/server.ts @@ -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 })