@@ -37,7 +37,8 @@ import * as widgets from '../widgets'
3737 *
3838 * @param context
3939 */
40- export function loggedInContext ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
40+ // used to be logIn
41+ export function ensureLoggedIn ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
4142 const me = authn . currentUser ( )
4243 if ( me ) {
4344 authn . saveUser ( me , context )
@@ -71,8 +72,8 @@ export function loggedInContext (context: AuthenticationContext): Promise<Authen
7172 *
7273 * @param context
7374 */
74- export async function logInLoadPreferences ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
75- // console.log('Solid UI logInLoadPreferences')
75+ // used to be logInLoadPreferences
76+ export async function ensureLoadedPreferences ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
7677 if ( context . preferencesFile ) return Promise . resolve ( context ) // already done
7778
7879 const statusArea = context . statusArea || context . div || null
@@ -89,7 +90,7 @@ export async function logInLoadPreferences (context: AuthenticationContext): Pro
8990 // reject(new Error(message))
9091 }
9192 try {
92- context = await logInLoadProfile ( context )
93+ context = await ensureLoadedProfile ( context )
9394
9495 // console.log('back in Solid UI after logInLoadProfile', context)
9596 const preferencesFile = await solidLogicSingleton . loadPreferences ( context . me as NamedNode )
@@ -140,13 +141,13 @@ export async function logInLoadPreferences (context: AuthenticationContext): Pro
140141 *
141142 * @returns Resolves with the context after login / fetch
142143 */
143- export async function logInLoadProfile ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
144- // console.log('Solid UI logInLoadProfile')
144+ // used to be logInLoadProfile
145+ export async function ensureLoadedProfile ( context : AuthenticationContext ) : Promise < AuthenticationContext > {
145146 if ( context . publicProfile ) {
146147 return context
147148 } // already done
148149 try {
149- const logInContext = await loggedInContext ( context )
150+ const logInContext = await ensureLoggedIn ( context )
150151 if ( ! logInContext . me ) {
151152 throw new Error ( 'Could not log in' )
152153 }
@@ -188,8 +189,8 @@ export async function findAppInstances (
188189 try {
189190 // console.log('calling logInLoad', isPublic)
190191 await ( isPublic
191- ? logInLoadProfile ( context )
192- : logInLoadPreferences ( context ) )
192+ ? ensureLoadedProfile ( context )
193+ : ensureLoadedPreferences ( context ) )
193194 // console.log('called logInLoad', isPublic)
194195 } catch ( err ) {
195196 widgets . complain ( context , `loadIndex: login and load problem ${ err } ` )
@@ -972,7 +973,7 @@ export function selectWorkspace (
972973 } // displayOptions
973974
974975 // console.log('kicking off async operation')
975- logInLoadPreferences ( context ) // kick off async operation
976+ ensureLoadedPreferences ( context ) // kick off async operation
976977 . then ( displayOptions )
977978 . catch ( err => {
978979 // console.log("err from async op")
@@ -1028,7 +1029,7 @@ export async function getUserRoles (): Promise<Array<NamedNode>> {
10281029 me,
10291030 preferencesFile,
10301031 preferencesFileError
1031- } = await logInLoadPreferences ( { } )
1032+ } = await ensureLoadedPreferences ( { } )
10321033 if ( ! preferencesFile || preferencesFileError ) {
10331034 throw new Error ( preferencesFileError )
10341035 }
0 commit comments