App Screen 2 (UI + Backend integration)

Blog post 5.1 | Hasura Internship

Link for my web app: which is not available every time.

Screen Two

Used to saw the update which posted by the logged in user. The data is fetch from the view called final_info as mentioned in my earlier blog posts.

function displaydata() {
// window.location = ‘/homepage.html’;
token = getCookie(“cookie_name”);
userId = getCookie(“cookie_user”);
url: dataUrl,
method: ‘post’,
headers: {
‘Authorization’: ‘Bearer ‘ + token,
‘Content-Type’: ‘application/json’
data: JSON.stringify({
“type”: “select”,
“args”: {
“table”: “final_info”,
“columns”: [“id”, “description”, “file_id”, “user_id”, “fullname”, “collegename”],
“where”: {“user_id”: userId}
}).done(function(data) {
var append_data = “”;
//for(var i =0; i<= data.length-1; i++)
for (var i = data.length — 1; i >= 0; i — ){
var append_data = append_data.concat(‘<article class=”timeline-entry”><div class=”timeline-entry-inner”><div class=”timeline-icon bg-success”><i class=”entypo-feather”></i></div><div class=”timeline-label”><h2><a href=”#”> ‘+data[i].fullname+’ </a><span>posted a new update from</span><strong> ‘+data[i].collegename+’ </strong></h2><h3>’+data[i].description+’</h3><div id=”image_div”></div></div></div></article>’);
}).fail(function(k) {

The above code is for fetching data from final_info view.