aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/buy/+page.server.js
blob: e03d6c0a4c794eacc0dcf625c31573b74e6b9d4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { env } from '$env/dynamic/private';
import { error, redirect } from '@sveltejs/kit';
import { post, auth } from '$lib/utils';
import { createTicket } from '$lib/ticket';

export const actions = {
	default: async ({ cookies, request }) => {
		let form = await request.formData();

		await post('/buy', {
			number: form.get('number').replace(/\s+/g, ''),
			month: form.get('expiry').slice(0, 2),
			year: form.get('expiry').slice(-2),
			cvc: form.get('cvc')
		}, auth(cookies));

		throw redirect(307, `/launch/thanks/${asset}`);
	}
};