Skip to content

Commit

Permalink
adds debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelp committed Jan 8, 2025
1 parent 01cc8b4 commit 2b1a229
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
1 change: 1 addition & 0 deletions apps/web/src/actions/user-profile-mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export const modifyAccountSettings = authenticatedAction
})
.where(eq(userCommonData.clerkID, userId));
} catch (err) {
console.log('error is', err);
if (
err instanceof DatabaseError &&
err.code === UNIQUE_KEY_CONSTRAINT_VIOLATION_CODE
Expand Down
15 changes: 3 additions & 12 deletions apps/web/src/components/settings/AccountSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { Input } from "@/components/shadcn/ui/input";
import { Button } from "@/components/shadcn/ui/button";
import { Label } from "@/components/shadcn/ui/label";
import { toast } from "sonner";
import { useEffect, useState } from "react";
import { useAction } from "next-safe-action/hooks";
import { modifyAccountSettings } from "@/actions/user-profile-mod";
import { Checkbox } from "@/components/shadcn/ui/checkbox";
import c from "config";
import { Loader2 } from "lucide-react";
import { isProfane } from "no-profanity";
import { modifyAccountSettingsSchema } from "@/validators/settings";
Expand All @@ -18,11 +16,11 @@ import { zodResolver } from "@hookform/resolvers/zod";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
FormDescription
} from "../shadcn/ui/form";

type UserProps = z.infer<typeof modifyAccountSettingsSchema>;
Expand All @@ -39,7 +37,6 @@ export default function AccountSettings({
defaultValues: {
...user,
},

});

const { execute: runModifyAccountSettings, status: loadingState } =
Expand Down Expand Up @@ -70,12 +67,6 @@ export default function AccountSettings({
},
});

useEffect(()=>{
console.log('is dirty is',form.formState.isDirty);
console.log("form.getValues()",form.getValues());
// console.log('form is dirty',form.formState.dirtyFields);
},[form.formState.isDirty])

function handleSubmit(data: UserProps) {
toast.dismiss();
console.log('form is dirty',form.formState.dirtyFields);
Expand Down Expand Up @@ -126,13 +117,13 @@ export default function AccountSettings({
</FormItem>
)}
/>
{/* <FormItem className="flex flex-col md:col-span-2">
<FormItem className="flex flex-col md:col-span-2">
<FormLabel>Email</FormLabel>
<Input value={email} disabled />
<FormDescription>
This field cannot be changed.
</FormDescription>
</FormItem> */}
</FormItem>
</div>
<h2 className="pb-5 pt-7 text-3xl font-semibold">
Public Information
Expand Down

0 comments on commit 2b1a229

Please sign in to comment.