Skip to content

Commit

Permalink
Show friends.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Sep 26, 2018
1 parent 65f57b7 commit e4b19b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ <h1>Profile viewer</h1>
<dl id="viewer">
<dt>Full name</dt>
<dd id="fullName"></dd>
<dt>Friends</dt>
<dd>
<ul id="friends"></ul>
</dd>
</dl>
<script src="scripts/jquery.js"></script>
<script src="scripts/solid-auth-client.bundle.js"></script>
Expand Down
10 changes: 10 additions & 0 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ $('#view').click(async () => {
// Display their details
const fullName = store.any($rdf.sym(person), FOAF('name'));
$('#fullName').text(fullName && fullName.value);

// Display their friends
const friends = store.each($rdf.sym(person), FOAF('knows'));
$('#friends').empty();
friends.forEach(async (friend) => {
await fetcher.load(friend);
const fullName = store.any(friend, FOAF('name'));
$('#friends').append($('<li>')
.text(fullName && fullName.value || friend.value));
});
});

0 comments on commit e4b19b0

Please sign in to comment.