Assume email when creating notifications

This commit is contained in:
=
2019-03-08 07:33:19 -08:00
parent 8a1e406f43
commit 1f7063f94e
2 changed files with 27 additions and 42 deletions

View File

@@ -49,16 +49,17 @@ app.get("/items/:url", async (req, res) => {
app.post("/marketalerts", function(req, res) {
const { email, last_date, olx_url } = req.body;
console.log(email, last_date, olx_url);
//res.json({ message: "Market Alert Created!" });
sequelize.sync().then(() =>
MarketAlert.create({
olx_url,
last_date,
email
})
res.json({ message: "Market Alert Created!" });
);
//res.json({ message: "Market Alert Created!" });
sequelize.sync().then(() => {
MarketAlert.create({
olx_url,
last_date,
email
})
.then(() => {
res.json({ message: "Market Alert Created!" });
})
.catch(e => console.error(e));
});
});
app.post("/payforalert", function(request, response) {

View File

@@ -154,38 +154,22 @@ class NotificationModal extends React.Component {
id="classic-modal-slide-description"
className={classes.modalBody}
>
<FormControlLabel
className={classes.whiteText}
control={
<Checkbox
className={classes.checkBoxStyle}
checked={this.isChecked("emailChecked")}
type={"checkbox"}
value={""}
onChange={() => this.optionChange("emailChecked")}
/>
}
label={<Typography style={{ color: "white" }}>Email</Typography>}
/>
{this.isChecked("emailChecked") ? (
<div>
<Input
className={classes.inputStyle}
placeholder="Email"
inputProps={{
"aria-label": "Email"
}}
type="email"
onChange={this.handleEmail}
/>
<Input
className={classes.inputStyle}
type="hidden"
value={token}
/>
</div>
) : null}
<div>
<Input
className={classes.inputStyle}
placeholder="Email"
inputProps={{
"aria-label": "Email"
}}
type="email"
onChange={this.handleEmail}
/>
<Input
className={classes.inputStyle}
type="hidden"
value={token}
/>
</div>
</DialogContent>
<DialogActions className={classes.modalFooter}>
{validEmail ? (