Commit 7214ba54 by Arjun Jhukal

updated the propell ads conversion

parent 450fd9f5
import DashboardLayout from '@/components/layouts/DashboardLayout' "use client";
import AgeVerificationModal from '@/components/organism/dialog'
import React from 'react' import DashboardLayout from '@/components/layouts/DashboardLayout';
import AgeVerificationModal from '@/components/organism/dialog';
import { useSearchParams } from 'next/navigation';
import React from 'react';
export default function DashboardRootLayout({ children }: { children: React.ReactNode }) { export default function DashboardRootLayout({ children }: { children: React.ReactNode }) {
const searchParams = useSearchParams();
const visitorId = searchParams.get("visitor_id");
localStorage.setItem("visitor_id", visitorId || "");
return ( return (
<DashboardLayout> <DashboardLayout>
{children} {children}
......
...@@ -116,7 +116,8 @@ export default function RegisterPage() { ...@@ -116,7 +116,8 @@ export default function RegisterPage() {
dob: null as Dayjs | null, dob: null as Dayjs | null,
city: '', city: '',
pob: '', pob: '',
agree: true agree: true,
visitor_id: undefined,
} }
const { deviceId } = useSeon(); const { deviceId } = useSeon();
const { handleSubmit, handleBlur, handleChange, errors, dirty, values, touched, setFieldValue, setFieldTouched } = useFormik( const { handleSubmit, handleBlur, handleChange, errors, dirty, values, touched, setFieldValue, setFieldTouched } = useFormik(
...@@ -125,6 +126,7 @@ export default function RegisterPage() { ...@@ -125,6 +126,7 @@ export default function RegisterPage() {
validationSchema, validationSchema,
onSubmit: async (values) => { onSubmit: async (values) => {
const formattedDob = values.dob ? dayjs(values.dob).format('YYYY-MM-DD') : ''; const formattedDob = values.dob ? dayjs(values.dob).format('YYYY-MM-DD') : '';
const userFromPropeelVisitorId = localStorage.getItem("visitor_id");
try { try {
const response = await registerUser({ const response = await registerUser({
email: values.emailAddress, email: values.emailAddress,
...@@ -140,7 +142,8 @@ export default function RegisterPage() { ...@@ -140,7 +142,8 @@ export default function RegisterPage() {
city: values.city, city: values.city,
pob: values.pob, pob: values.pob,
agree: values.agree, agree: values.agree,
device_id: deviceId device_id: deviceId,
visitor_id: userFromPropeelVisitorId || undefined,
}).unwrap(); }).unwrap();
dispatch( dispatch(
...@@ -151,6 +154,7 @@ export default function RegisterPage() { ...@@ -151,6 +154,7 @@ export default function RegisterPage() {
}), }),
); );
router.replace(`${PATH.AUTH.VERIFY_EMAIL.ROOT}?email=${values.emailAddress}`); router.replace(`${PATH.AUTH.VERIFY_EMAIL.ROOT}?email=${values.emailAddress}`);
localStorage.removeItem("visitor_id");
} }
catch (e: any) { catch (e: any) {
dispatch( dispatch(
......
...@@ -8,19 +8,11 @@ export const authApi = createApi({ ...@@ -8,19 +8,11 @@ export const authApi = createApi({
baseQuery: baseQuery, baseQuery: baseQuery,
endpoints: (builder) => ({ endpoints: (builder) => ({
registerUser: builder.mutation<{ success: boolean, data: LoginResponse | null, message: string }, RegisterProps>({ registerUser: builder.mutation<{ success: boolean, data: LoginResponse | null, message: string }, RegisterProps>({
query: ({ email, query: (body) => ({
username, url: `/api/auth/register`,
password, method: "POST",
password_confirmation, first_name, middle_name, last_name, phone, photoid_number, dob, city, pob, agree,device_id }) => ({ body
url: `/api/auth/register`, }),
method: "POST",
body: {
email,
username,
password,
password_confirmation, first_name, middle_name, last_name, phone, photoid_number, dob, city, pob, agree,device_id
},
}),
}), }),
login: builder.mutation<LoginResponse, LoginProps>({ login: builder.mutation<LoginResponse, LoginProps>({
...@@ -37,11 +29,11 @@ export const authApi = createApi({ ...@@ -37,11 +29,11 @@ export const authApi = createApi({
body: { email }, body: { email },
}) })
}), }),
verifyEmail: builder.mutation<GlobalResponse, { id: string; hash: string,device_id:string }>({ verifyEmail: builder.mutation<GlobalResponse, { id: string; hash: string, device_id: string }>({
query: ({ id, hash ,device_id}) => ({ query: ({ id, hash, device_id }) => ({
url: "/api/auth/verify-email", url: "/api/auth/verify-email",
method: "POST", method: "POST",
body: { id, hash,device_id}, body: { id, hash, device_id },
}) })
}), }),
forgotPassword: builder.mutation<GlobalResponse, { email: string }>({ forgotPassword: builder.mutation<GlobalResponse, { email: string }>({
......
...@@ -41,4 +41,5 @@ export interface RegisterProps extends LoginProps { ...@@ -41,4 +41,5 @@ export interface RegisterProps extends LoginProps {
pob: string; pob: string;
agree: boolean; agree: boolean;
device_id?: string; device_id?: string;
visitor_id?: string;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment