fixes / register user
This commit is contained in:
@@ -83,15 +83,24 @@ export default function Settings() {
|
||||
});
|
||||
const history = useHistory();
|
||||
const style = useStyles();
|
||||
const isRestaurant = useSelector((store) => store.data.userData.isRestaurant)
|
||||
const data = useSelector((state) => state.data.userData);
|
||||
const initialState = {
|
||||
firstname: data.firstname,
|
||||
lastname: data.lastname,
|
||||
email: data.userEmail,
|
||||
NIP: data.billing.NIP,
|
||||
adress: data.billing.adress,
|
||||
companyName: data.billing.companyName,
|
||||
};
|
||||
let initialState;
|
||||
if(isRestaurant === true) {
|
||||
initialState = {
|
||||
firstname: data.firstname,
|
||||
lastname: data.lastname,
|
||||
email: data.userEmail,
|
||||
NIP: data.billing.NIP,
|
||||
adress: data.billing.adress,
|
||||
companyName: data.billing.companyName,
|
||||
};
|
||||
} else {
|
||||
initialState = {
|
||||
email: data.userEmail,
|
||||
login: data.login,
|
||||
};
|
||||
}
|
||||
const [state, setState] = useState(initialState);
|
||||
return (
|
||||
<Dialog aria-labelledby="settings-title" className={style.root} open={true}>
|
||||
@@ -104,7 +113,7 @@ export default function Settings() {
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
<Divider />
|
||||
<DialogContent>
|
||||
{isRestaurant && (<DialogContent>
|
||||
<TextField
|
||||
className={style.textInput}
|
||||
value={state.firstname}
|
||||
@@ -202,7 +211,28 @@ export default function Settings() {
|
||||
<Divider />
|
||||
<ButtonPrimary onClick={() => history.goBack()} text="Anuluj" />
|
||||
<ButtonSecondary text="Zapisz" />
|
||||
</DialogContent>
|
||||
</DialogContent>)}
|
||||
{!isRestaurant && (<DialogContent>
|
||||
<TextField
|
||||
className={style.textInput}
|
||||
value={state.email}
|
||||
onChange={(event) =>
|
||||
setState({ ...state, email: event.target.value })
|
||||
}
|
||||
label="Email"
|
||||
variant="outlined"
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<AlternateEmailIcon color="primary"/>
|
||||
</InputAdornment>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<Divider />
|
||||
<ButtonPrimary onClick={() => history.goBack()} text="Anuluj" />
|
||||
<ButtonSecondary text="Zapisz" />
|
||||
</DialogContent>)}
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user