LDflex / Query-Solid

Simple access to data in Solid pods through LDflex expressions
https://solid.github.io/query-ldflex/
MIT License
66 stars 15 forks source link

Can't seem to get this to work in the browser #2

Closed SQL-MisterMagoo closed 5 years ago

SQL-MisterMagoo commented 5 years ago

Hi, I have a simple html page for now and I wanted to test logging in to a Solid pod and also retrieving the name from the pod to display "Hello Joe" or whatever.

I have added the two scripts to my html

<script src="solid-auth-client.bundle.js"></script>
<script src="solid-query-ldflex.bundle.js"></script>

I can log in and out.

but if I try this in the console, await solid.data['https://mistermagoo.inrupt.net/profile/card#me'].name I get the result undefined

If I try without the "card", I get an error Error: Could not retrieve https://mistermagoo.inrupt.net/profile/ (401)

I think the syntax is correct, because I can enter this in the browser console await solid.data['https://ruben.verborgh.org/profile/#me'].name and get this result h {id: ""Ruben Verborgh"@en", toString: ƒ, toPrimitive: ƒ}

I have tested this using your playground and that can read the name correctly, so it seems I am doing something wrong in my app.

RubenVerborgh commented 5 years ago

This indeed works for me on https://solid.github.io/ldflex-playground/

Are you sure you have the latest version of solid-query-ldflex.bundle.js? I think you are probably hitting https://github.com/comunica/comunica/issues/311, which recently got fixed.

SQL-MisterMagoo commented 5 years ago

Hi Ruben,

Thanks for the reply - I also found it works on playground, which is why I wondered what I was doing wrong.

I'm not sure I am using the latest bundle - I found it hard to locate an actual release of the bundle, so had to build it from source.

Is there a good place to find the latest bundle?

SQL-MisterMagoo commented 5 years ago

Actually, I don't know what went wrong last time, but I just installed it again from npm and it now works.

Thanks for helping.

RubenVerborgh commented 5 years ago

Great to hear, thanks for testing!

Is there a good place to find the latest bundle?

It is part of the npm package, as dist/solid-query-ldflex.bundle.js. And bleeding edge is at https://solid.github.io/query-ldflex/dist/solid-query-ldflex.bundle.js