Skip to content

Commit

Permalink
fix(web): payload json stringified
Browse files Browse the repository at this point in the history
  • Loading branch information
kemuru committed Sep 7, 2023
1 parent 7cc3dd4 commit bcbf73b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web/netlify/functions/update-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const SUPABASE_URL = process.env.SUPABASE_URL;
const supabase = createClient(SUPABASE_URL!, SUPABASE_KEY!);
export const uploadSettingsToSupabase = async function (event: any, context: any) {
try {
const { message, address, signature } = event.body;
const { message, address, signature } = JSON.parse(event.body);
const email = message.replace(/\n|\r/g, "").split("Email:").pop().split("Nonce:")[0].trim();
const nonce = message.split("Nonce:").pop().trim();
console.log(
Expand Down
4 changes: 3 additions & 1 deletion web/src/utils/uploadSettingsToSupabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { toast } from "react-toastify";
import { OPTIONS } from "utils/wrapWithToast";

export function uploadSettingsToSupabase(formData: any): Promise<Response> {
console.log("formdata", formData);
console.log("stringified formdata", JSON.stringify(formData));
return toast.promise<Response, Error>(
fetch("./netlify/functions/update-settings", {
method: "POST",
body: formData,
body: JSON.stringify(formData),
}).then(async (response) => {
if (response.status !== 200) {
const error = await response.json().catch(() => ({ message: "Error uploading to Supabase" }));
Expand Down

0 comments on commit bcbf73b

Please sign in to comment.