Skip to content

Commit

Permalink
fixed the response of platform api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
myjyby committed Oct 30, 2024
1 parent 8c62e1a commit d891aa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions public/js/data/load.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const loadData = async function (_params) {
promises.push(GET(stats));
promises.push(
GET(pads)
.then(res => {
const [ data ] = res;
.then(data => {
// const [ data ] = res;
data.forEach(d => d.source = `${origin}/en/view/pad?id=${d.pad_id}`);
return data;
})
Expand Down
4 changes: 2 additions & 2 deletions routes/datasources.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ exports.increase = (req, res) => {
promises.push(
fetch(pads)
.then(response => response.json())
.then(json => {
const [ data ] = json;
.then(data => {
// const [ data ] = json;
data.forEach(d => d.source = `${origin}/en/view/pad?id=${d.pad_id}`);
return data;
}).catch(err => console.log(err))
Expand Down
6 changes: 2 additions & 4 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ exports.home = (req, res) => {
batch.push(t.any(`SELECT * FROM notes;`))
batch.push(t.any(`SELECT * FROM titles;`))
return t.batch(batch)
})
.then(data => {
}).then(data => {
res.render('home', { title: 'post it', notes: JSON.stringify(data[0]), titles: JSON.stringify(data[1]) })
})
.catch(err => console.log(err))
}).catch(err => console.log(err))
}
exports.wall = (req, res) => {
const { id: wallId } = req.params;
Expand Down

0 comments on commit d891aa7

Please sign in to comment.