Minor changes

This commit is contained in:
Eknoor Singh 2025-02-13 11:14:14 +05:30
parent f921de656d
commit 6740831762
4 changed files with 14 additions and 11 deletions

View file

@ -86,8 +86,8 @@ export default function SideMenu() {
>
<Avatar
sizes="small"
alt="Riley Carter"
src="/static/images/avatar/7.jpg"
alt={user?.name || "User Avatar"}
src={"/static/images/avatar/7.jpg"}
sx={{ width: open ? 36 : 0, height: open ? 36 : 0 }}
/>
<Box sx={{ mr: "auto", display: !open ? "none" : "block" }}>

View file

@ -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)

View file

@ -89,7 +89,7 @@ const ProfilePage = () => {
Phone: {user?.phone || "N/A"}
</Typography>
<Typography variant="body2" color="text.secondary">
Role: {user?.role || "N/A"}
Role: <b>{user?.role || "N/A"}</b>
</Typography>
</Grid>
</Grid>

View file

@ -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(