A tutorial of sorts for a test post

Words
108
Reading
1 min
Listen
Play
5y

blokz.js New Post

While working on the "New Post" feature of http://personal.community I had to do some shit test posts to test a redirect to post function, so, figured I'd share some of what's needed for a new post on $hive using a posting key and hivejs

First, the relevant code I'm updating...

hive.broadcast.comment(
      document.getElementById('postingKey').value,
      parentAuthor, 
      parentPermlink, 
      postingAs,
      postpermLink, 
      postTitle,
      postData,
      {
        tags: ['blog'],
        app: 'blokz'
      },
      function (err, result) {
        if (err)
          document.getElementById("display").innerHTML = "

something went wrong...

"
+ err; else document.getElementById("display").innerHTML = "

view post: "

+ postpermLink + " click the x or outside the box to close
"
+ result; } ); // broadcast.comment
source: https://personal.community/js/blokz.js

Reading the API docs for hivejs, it shows the following:

hive.broadcast.comment(wif, parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, function(err, result) {
  console.log(err, result);
});

Ultimately, the code I'm adding is

setTimeout(() => {
    let url = "../?post=" + hiveuser + "/" + postpermlink;
    window.location.href = url;
}, 8000); 

inside the else potion of the function, basically just saying redirect the page to https://personal.community/?post=USERNAME/PERMLINK in 8 seconds.

but this code is outdated... so it really dont matter. hahaha. but hey, it looks like a good test post. ;)

A tutorial of sorts for a test post | Ecency