@live-change/user-service
Advanced tools
Comparing version 0.2.8 to 0.2.10
@@ -19,12 +19,17 @@ const App = require('@live-change/framework') | ||
await authenticatedTable.object(session).onChange(async (authData, oldAuthData) => { | ||
output.debug("NEW USER AUTH", authData, "FROM", oldAuthData) | ||
const newUser = authData ? authData.user : null | ||
if(newUser == user) return | ||
if(user) { | ||
await userObject.unobserve(userObserver) | ||
if(userObject) { | ||
await userObject.unobserve(userObserver) | ||
} | ||
userObject = null | ||
userObserver = null | ||
} | ||
if(authData.user) { | ||
if(newUser) { | ||
user = newUser | ||
output.debug("NEW USER", user) | ||
userObject = userTable.object(user) | ||
const currentUserObject = userObject | ||
await userObject.onChange(async (userData, oldUserData) => { | ||
@@ -36,2 +41,3 @@ const newCredentials = userData ? { | ||
} : null | ||
output.debug("NEW CREDENTIALS", newCredentials) | ||
output.change(newCredentials, oldCredentials) | ||
@@ -43,3 +49,3 @@ oldCredentials = newCredentials | ||
} else { // if user changed before observer loaded data | ||
userObject.unobserve(observer) | ||
currentUserObject.unobserve(observer) | ||
} | ||
@@ -46,0 +52,0 @@ }) |
10
index.js
@@ -52,12 +52,2 @@ const app = require("@live-change/framework").app() | ||
name: 'signOut', | ||
properties: { | ||
user: { | ||
type: User, | ||
validation: ['nonEmpty'] | ||
}, | ||
session: { | ||
type: Session, | ||
validation: ['nonEmpty'] | ||
} | ||
}, | ||
async execute({ }, { client, service }, emit) { | ||
@@ -64,0 +54,0 @@ if(!client.user) throw "notSignedIn" |
{ | ||
"name": "@live-change/user-service", | ||
"version": "0.2.8", | ||
"version": "0.2.10", | ||
"description": "", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "1e8102d02b6745fea401e967c211c6a9cb03e19b" | ||
"gitHead": "ae86524e5ac7052eb6b6e7b34e319373b6bdef23" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18597
226
150
488
32
59