more buxfix
This commit is contained in:
parent
c85f5a3324
commit
2511082f14
|
@ -52,6 +52,8 @@ const AddModal = ({onExit}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onExit();
|
onExit();
|
||||||
|
} else if(name != '' && link != '' && tag != '') {
|
||||||
|
alert('Please make sure the link is valid.\n\n(i.e. starts with "http"/"https")');
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import '../styles/List.css';
|
import '../styles/List.css';
|
||||||
import { useState } from 'react';
|
|
||||||
|
|
||||||
const List = ({data}) => {
|
const List = ({data}) => {
|
||||||
const [reload, setReload] = useState(0);
|
function deleteEntity(id) {
|
||||||
|
|
||||||
async function deleteEntity(id) {
|
|
||||||
fetch("/delete", {
|
fetch("/delete", {
|
||||||
|
|
||||||
// Adding method type
|
// Adding method type
|
||||||
|
|
|
@ -22,16 +22,22 @@ app.post('/post', (req, res) => {
|
||||||
let title;
|
let title;
|
||||||
const pageToVisit = req.body.link;
|
const pageToVisit = req.body.link;
|
||||||
request(pageToVisit, (error, response, body) => {
|
request(pageToVisit, (error, response, body) => {
|
||||||
if(response.statusCode === 200) {
|
try {
|
||||||
// Parse the document body
|
if(response.statusCode === 200) {
|
||||||
const $ = cheerio.load(body);
|
// Parse the document body
|
||||||
|
const $ = cheerio.load(body);
|
||||||
|
|
||||||
req.body.title = $('title').text();
|
req.body.title = $('title').text();
|
||||||
insertDoc(req.body);
|
insertDoc(req.body);
|
||||||
} else {
|
} else {
|
||||||
req.body.title = null;
|
req.body.title = null;
|
||||||
insertDoc(req.body);
|
insertDoc(req.body);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
req.body.title = null;
|
||||||
|
insertDoc(req.body);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue