You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sign in (login form or something), which calls the handler:
const{ signin }=useSurrealWS()constresult=awaitsignin({/* auth data */})console.trace(result)// returns false, even though it should return a token.
Currently, the isReady.auth value in surreal-ws.js stays at false because a successful signin is never parsed (since id=1 is hardcoded and id=1 is never used to send the signin request).
This causes all queries (including signin) to return false. It does run the _init() function every time, but the _init() function does not correctly login either. It sends a potential userToken (from useSurrealAuth) or an options.auth - but never does it use anything related to the signin function.
Perhaps it makes sense to overwrite the authId when sending the signin request, or use the authId when sending the signin request instead of the auto-incremented message id?
This does not seem to be version-related, but for sake of completness:
SurrealDB version v2.0.4 and nuxt-surrealdb version v0.3.4
The text was updated successfully, but these errors were encountered:
That might explain the generated surreal-ws.d.ts file saying that (almost) all functions return boolean and not boolean | any.
Oh, about this: no they are supposed to only return booleans. If you need to access the actual information you have to access data to do so.
In the your provided snipped you should do something like (although, still not ideal):
const{ data, signin }=useSurrealWS()constresult=awaitsignin({/* auth data */})if(result){console.trace(data.value)}
This is one of the reasons why I suggest to use signin operations outside/before creating a ws connection.
data will update whenever SurrealDB has to inform you about something you have executed or subscribed at (like with a live('table_name')), but I currently don't inform which id is about which data return.
I can already see me rewrite useSurrealWS from scratch...
Workflow:
Currently, the
isReady.auth
value insurreal-ws.js
stays atfalse
because a successfulsignin
is never parsed (since id=1 is hardcoded and id=1 is never used to send thesignin
request).This causes all queries (including
signin
) to returnfalse
. It does run the_init()
function every time, but the_init()
function does not correctly login either. It sends a potentialuserToken
(fromuseSurrealAuth
) or anoptions.auth
- but never does it use anything related to thesignin
function.Perhaps it makes sense to overwrite the
authId
when sending thesignin
request, or use theauthId
when sending thesignin
request instead of the auto-incremented message id?This does not seem to be version-related, but for sake of completness:
SurrealDB version v2.0.4 and nuxt-surrealdb version v0.3.4
The text was updated successfully, but these errors were encountered: