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 <Avatar
sizes="small" sizes="small"
alt="Riley Carter" alt={user?.name || "User Avatar"}
src="/static/images/avatar/7.jpg" src={"/static/images/avatar/7.jpg"}
sx={{ width: open ? 36 : 0, height: open ? 36 : 0 }} sx={{ width: open ? 36 : 0, height: open ? 36 : 0 }}
/> />
<Box sx={{ mr: "auto", display: !open ? "none" : "block" }}> <Box sx={{ mr: "auto", display: !open ? "none" : "block" }}>

View file

@ -84,7 +84,7 @@ const dispatch = useDispatch();
const [countryCode, setCountryCode] = React.useState(''); const [countryCode, setCountryCode] = React.useState('');
const [phoneNumber, setPhoneNumber] = 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 // Match the country code (e.g., +91) and the rest of the number
const match = phone.match(/^(\+\d{1,3})\s*(\d+.*)/); const match = phone.match(/^(\+\d{1,3})\s*(\d+.*)/);
if (match) { if (match) {
@ -92,7 +92,7 @@ const dispatch = useDispatch();
} }
return { countryCode: '', numberWithoutCountryCode: phone }; return { countryCode: '', numberWithoutCountryCode: phone };
}; };
const handleOnChange = (newPhone) => { const handleOnChange = (newPhone: string) => {
const { countryCode, numberWithoutCountryCode } = extractCountryCodeAndNumber(newPhone); const { countryCode, numberWithoutCountryCode } = extractCountryCodeAndNumber(newPhone);
console.log("numberWithoutCountryCode",numberWithoutCountryCode); console.log("numberWithoutCountryCode",numberWithoutCountryCode);
setPhoneNumber(numberWithoutCountryCode) setPhoneNumber(numberWithoutCountryCode)

View file

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

View file

@ -62,14 +62,17 @@ export const loginUser = createAsyncThunk<
// Async thunk for register // Async thunk for register
export const registerUser = createAsyncThunk< export const registerUser = createAsyncThunk<
User, User,
{ email: string; password: string }, {
name: string;
email: string;
password: string;
phone: string;
role: string;
},
{ rejectValue: string } { rejectValue: string }
>("auth/register", async (data, { rejectWithValue }) => { >("auth/signup", async (data, { rejectWithValue }) => {
try { try {
const response = await axios.post( const response = await apiHttp.post("auth/signup", data);
"https://health-digi.dmlabs.in/auth/register",
data
);
return response.data; return response.data;
} catch (error: any) { } catch (error: any) {
return rejectWithValue( return rejectWithValue(