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