signing petition through fetch request instead of direct db connection
This commit is contained in:
@@ -60,7 +60,8 @@
|
||||
"tailwind-merge": "^2.6.0",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"vaul": "^0.9.9",
|
||||
"zod": "^3.25.76"
|
||||
"zod": "^4.1.12",
|
||||
"types": "workspace:types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.32.0",
|
||||
|
||||
15
packages/frontend/src/network/index.ts
Normal file
15
packages/frontend/src/network/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { z } from "zod";
|
||||
import { signedPetitionSchema, signPetitionSchema } from 'types';
|
||||
|
||||
const baseURL = import.meta.env.BASE_URL;
|
||||
|
||||
export const signSignature = async (signature: z.infer<typeof signPetitionSchema>): Promise<z.infer<typeof signedPetitionSchema>> => {
|
||||
const res = await fetch(baseURL, {
|
||||
method: 'POST', body: JSON.stringify(signature),
|
||||
})
|
||||
|
||||
const body = await res.json();
|
||||
const validatedBody = signedPetitionSchema.parse(body);
|
||||
|
||||
return validatedBody
|
||||
}
|
||||
0
packages/frontend/src/state/index.ts
Normal file
0
packages/frontend/src/state/index.ts
Normal file
Reference in New Issue
Block a user