Skip to content

Instantly share code, notes, and snippets.

@aanya963
Created December 26, 2023 10:24
Show Gist options
  • Select an option

  • Save aanya963/53b1308de4c43c9df98aba40d24e6ce3 to your computer and use it in GitHub Desktop.

Select an option

Save aanya963/53b1308de4c43c9df98aba40d24e6ce3 to your computer and use it in GitHub Desktop.
import { superValidate, message } from 'sveltekit-superforms/server';
// import { requestSchema } from '$lib/schemas';
import { z } from 'zod';
let actionResponse = {
status: 'failed',
content: ''
};
export const load = async ({ cookies }) => {
return {
jwtToken: cookies.get('jwtToken')
};
};
const schema = z.object({
payerPaymail: z.string(),
amount: z.string()
});
export const actions = {
send: async ({ request }) => {
const form = await superValidate(request, schema);
console.log('POST', form);
if (!form.valid) {
return message(form, actionResponse);
}
return message(form, {
...actionResponse,
status: 'success',
content: 'Login successful! You are now logged in.',
successType: 'phoneverify'
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment