diff --git a/apps/ios/.build/index-build/arm64-apple-macosx/debug/index/db/v13/p83063--1accd9/lock.mdb b/apps/ios/.build/index-build/arm64-apple-macosx/debug/index/db/v13/p83063--1accd9/lock.mdb index ffcd925..fe89e11 100644 Binary files a/apps/ios/.build/index-build/arm64-apple-macosx/debug/index/db/v13/p83063--1accd9/lock.mdb and b/apps/ios/.build/index-build/arm64-apple-macosx/debug/index/db/v13/p83063--1accd9/lock.mdb differ diff --git a/apps/ios/Bagsy.xcodeproj/project.xcworkspace/xcuserdata/barnabasbodily.xcuserdatad/UserInterfaceState.xcuserstate b/apps/ios/Bagsy.xcodeproj/project.xcworkspace/xcuserdata/barnabasbodily.xcuserdatad/UserInterfaceState.xcuserstate index ae2a8f7..01d2811 100644 Binary files a/apps/ios/Bagsy.xcodeproj/project.xcworkspace/xcuserdata/barnabasbodily.xcuserdatad/UserInterfaceState.xcuserstate and b/apps/ios/Bagsy.xcodeproj/project.xcworkspace/xcuserdata/barnabasbodily.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/apps/ios/Bagsy/ShopList/App/AppState.swift b/apps/ios/Bagsy/ShopList/App/AppState.swift index 00eaab7..96856b0 100644 --- a/apps/ios/Bagsy/ShopList/App/AppState.swift +++ b/apps/ios/Bagsy/ShopList/App/AppState.swift @@ -168,18 +168,21 @@ class AppState: ObservableObject { self.currentUser = authData.user self.currentHousehold = authData.household try await cacheManager.cacheUser(authData.user) - try await cacheManager.cacheHousehold(authData.household) + if let household = authData.household { + try await cacheManager.cacheHousehold(household) + await webSocketManager.connect( + householdId: household.id, + userId: authData.user.id, + baseURL: serverURL + ) + } self.isAuthenticated = true - await webSocketManager.connect( - householdId: authData.household.id, - userId: authData.user.id, - baseURL: serverURL - ) - - // Set token in PasskeyHelper and initiate passkey setup + // Set token in PasskeyHelper and setup passkey if household exists PasskeyHelper.shared.setAuthToken(authData.session.token) - try await setupPasskey() + if authData.household != nil { + try await setupPasskey() + } } func createHousehold(name: String) async throws { @@ -294,7 +297,7 @@ struct SignInPayload: Codable { struct AuthResponse: Codable { let user: User - let household: Household + let household: Household? let session: Session }