From 6740831762e0deec4cf486fb9ee83f7c04799135 Mon Sep 17 00:00:00 2001 From: Eknoor Singh Date: Thu, 13 Feb 2025 11:14:14 +0530 Subject: [PATCH] Minor changes --- src/components/SideMenu/index.tsx | 4 ++-- src/pages/Auth/SignUp/index.tsx | 4 ++-- src/pages/ProfilePage/index.tsx | 2 +- src/redux/slices/authSlice.ts | 15 +++++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/components/SideMenu/index.tsx b/src/components/SideMenu/index.tsx index 6510422..009f59a 100644 --- a/src/components/SideMenu/index.tsx +++ b/src/components/SideMenu/index.tsx @@ -86,8 +86,8 @@ export default function SideMenu() { > diff --git a/src/pages/Auth/SignUp/index.tsx b/src/pages/Auth/SignUp/index.tsx index 5ac7e73..b4dafd3 100644 --- a/src/pages/Auth/SignUp/index.tsx +++ b/src/pages/Auth/SignUp/index.tsx @@ -84,7 +84,7 @@ const dispatch = useDispatch(); const [countryCode, setCountryCode] = React.useState(''); const [phoneNumber, setPhoneNumber] = React.useState(''); - const extractCountryCodeAndNumber = (phone) => { + const extractCountryCodeAndNumber = (phone: string) => { // Match the country code (e.g., +91) and the rest of the number const match = phone.match(/^(\+\d{1,3})\s*(\d+.*)/); if (match) { @@ -92,7 +92,7 @@ const dispatch = useDispatch(); } return { countryCode: '', numberWithoutCountryCode: phone }; }; - const handleOnChange = (newPhone) => { + const handleOnChange = (newPhone: string) => { const { countryCode, numberWithoutCountryCode } = extractCountryCodeAndNumber(newPhone); console.log("numberWithoutCountryCode",numberWithoutCountryCode); setPhoneNumber(numberWithoutCountryCode) diff --git a/src/pages/ProfilePage/index.tsx b/src/pages/ProfilePage/index.tsx index bc0e7bb..2b9987b 100644 --- a/src/pages/ProfilePage/index.tsx +++ b/src/pages/ProfilePage/index.tsx @@ -89,7 +89,7 @@ const ProfilePage = () => { Phone: {user?.phone || "N/A"} - Role: {user?.role || "N/A"} + Role: {user?.role || "N/A"} diff --git a/src/redux/slices/authSlice.ts b/src/redux/slices/authSlice.ts index 2835d05..6984d9a 100644 --- a/src/redux/slices/authSlice.ts +++ b/src/redux/slices/authSlice.ts @@ -62,14 +62,17 @@ export const loginUser = createAsyncThunk< // Async thunk for register export const registerUser = createAsyncThunk< User, - { email: string; password: string }, + { + name: string; + email: string; + password: string; + phone: string; + role: string; + }, { rejectValue: string } ->("auth/register", async (data, { rejectWithValue }) => { +>("auth/signup", async (data, { rejectWithValue }) => { try { - const response = await axios.post( - "https://health-digi.dmlabs.in/auth/register", - data - ); + const response = await apiHttp.post("auth/signup", data); return response.data; } catch (error: any) { return rejectWithValue(