Created
December 26, 2023 10:24
-
-
Save aanya963/53b1308de4c43c9df98aba40d24e6ce3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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