minor fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
const Sequelize = require("sequelize");
|
const Sequelize = require("sequelize");
|
||||||
const sequelize = new Sequelize("sql7274844", "sql7274844", "upMgevlgak", {
|
const sequelize = new Sequelize("sql7276322", "sql7276322", "RS53ihYlg9", {
|
||||||
host: "sql7.freemysqlhosting.net",
|
host: "sql7.freemysqlhosting.net",
|
||||||
dialect: "mysql",
|
dialect: "mysql",
|
||||||
operatorsAliases: false
|
operatorsAliases: false
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ app.use(bodyParser.urlencoded({ extended: true }));
|
|||||||
|
|
||||||
const port = process.env.PORT || 5000;
|
const port = process.env.PORT || 5000;
|
||||||
|
|
||||||
app.get("/api/sendnotifications", async function(req, res) {
|
app.get("/sendnotifications", async function(req, res) {
|
||||||
let marketAlerts = await MarketAlert.findAll();
|
let marketAlerts = await MarketAlert.findAll();
|
||||||
|
|
||||||
let lastDateUpdate = await Promise.all(
|
let lastDateUpdate = await Promise.all(
|
||||||
@@ -33,7 +33,7 @@ app.get("/api/sendnotifications", async function(req, res) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/api/:url", async (req, res) => {
|
app.get("/items/:url", async (req, res) => {
|
||||||
let url =
|
let url =
|
||||||
"https://www.olx.ba/pretraga?" +
|
"https://www.olx.ba/pretraga?" +
|
||||||
req.params.url +
|
req.params.url +
|
||||||
@@ -45,7 +45,7 @@ app.get("/api/:url", async (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/marketalerts", function(req, res) {
|
app.post("/marketalerts", function(req, res) {
|
||||||
const { email, last_date, olx_url } = req.body;
|
const { email, last_date, olx_url } = req.body;
|
||||||
sequelize.sync().then(() =>
|
sequelize.sync().then(() =>
|
||||||
MarketAlert.create({
|
MarketAlert.create({
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class App extends React.Component {
|
|||||||
onUserDataChange({ info: "olx_url", value: url });
|
onUserDataChange({ info: "olx_url", value: url });
|
||||||
if (url) {
|
if (url) {
|
||||||
axios
|
axios
|
||||||
.get(`/api/${url}`)
|
.get(`/items/${url}`)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
onItemsChanged(response.data.items);
|
onItemsChanged(response.data.items);
|
||||||
onUserDataChange({
|
onUserDataChange({
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class NotificationModal extends React.Component {
|
|||||||
userdata: { email, last_date, olx_url }
|
userdata: { email, last_date, olx_url }
|
||||||
} = this.props;
|
} = this.props;
|
||||||
axios
|
axios
|
||||||
.post("/api/marketalerts", {
|
.post("/marketalerts", {
|
||||||
email,
|
email,
|
||||||
last_date,
|
last_date,
|
||||||
olx_url
|
olx_url
|
||||||
@@ -138,7 +138,12 @@ class NotificationModal extends React.Component {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions className={classes.modalFooter}>
|
<DialogActions className={classes.modalFooter}>
|
||||||
{validEmail ? (
|
{validEmail ? (
|
||||||
<Button className={classes.saveButton}>Save</Button>
|
<Button
|
||||||
|
onClick={this.handleSaveMarketAlert}
|
||||||
|
className={classes.saveButton}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title="Provide a valid email"
|
title="Provide a valid email"
|
||||||
|
|||||||
Reference in New Issue
Block a user