Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
fix syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
glazec committed Feb 17, 2020
1 parent 76b1d37 commit 81091b2
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ async function maim() {
newPostRepo = JSON.parse(JSON.stringify(newPostRepo))
console.log(newPostOnlineSite)
console.log(newPostRepo)

//publish the site
fetch(process.env.buildHook, { method: 'POST' });
if (newPostOnlineSite.id != newPostRepo.id) {

if (newPostOnlineSite.id != newPostRepo.id) {
// push new Post notificaiton

payload = { "title": newPostRepo.title, "message": newPostRepo.summary, "target_url": newPostRepo.url }
const response = await fetch('https://app.webpushr.com/api/v1/notification/send/all', {
method: 'POST',
Expand All @@ -32,22 +32,19 @@ async function maim() {
body: JSON.stringify(payload),
});
const data = await response.json();

if (!response.ok) {
// NOT res.status >= 200 && res.status < 300
return JSON.stringify({ statusCode: data.status, body: data.detail });
}
return (
"Successfully push notification"),



return ("Successfully push notification")
}

else {
return (
"No New Post detected.");
}

} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit 81091b2

Please sign in to comment.