Skip to content

Commit

Permalink
fix example project
Browse files Browse the repository at this point in the history
  • Loading branch information
frontegg-david committed Nov 1, 2024
1 parent 42dfc06 commit 6240c3b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions example/ios/App/App/App.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:auth.davidantoon.me</string>
<string>applinks:auth.davidantoon.me</string>
<string>webcredentials:davidantoon.me</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion example/src/app/tab1/tab1.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
</ion-header>

<br/>
<ion-text>isLoading: {{user ? user.email : 'Not Logged In' }}</ion-text>
<ion-text>Email: {{user ? user.email : 'Not Logged In' }}</ion-text>
<br/>
<ion-text>isLoading: {{isLoading ? 'true' : 'false'}}</ion-text>
<br/>
<ion-text>Is Refreshing Token: {{refreshingToken ? 'true' : 'false'}}</ion-text>
<br/>
<ion-text>isAuthenticated: {{isAuthenticated ? 'true' : 'false'}}</ion-text>
<br/>
<ion-text>Active Tenant: {{user?.activeTenant?.name}}</ion-text>
Expand Down
8 changes: 7 additions & 1 deletion example/src/app/tab1/tab1.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ export class Tab1Page implements OnInit {

user: FronteggState['user'] = null
isLoading: boolean = true
refreshingToken: boolean = false
isAuthenticated: boolean = false
accessToken: string | null = null


ngOnInit() {
console.log('start listening')

const { user, isAuthenticated, accessToken, isLoading } = this.fronteggService.getState();
const { user, isAuthenticated, accessToken, isLoading, refreshingToken } = this.fronteggService.getState();
this.user = user;
this.isAuthenticated = isAuthenticated;
this.accessToken = accessToken;
this.refreshingToken = refreshingToken;
this.isLoading = isLoading;

this.fronteggService.$user.subscribe((user) => {
Expand All @@ -34,6 +36,10 @@ export class Tab1Page implements OnInit {
console.log('change isLoading', isLoading)
this.ngZone.run(() => this.isLoading = isLoading)
})
this.fronteggService.$refreshingToken.subscribe((refreshingToken) => {
console.log('change refreshingToken', refreshingToken)
this.ngZone.run(() => this.refreshingToken = refreshingToken)
})
this.fronteggService.$isAuthenticated.subscribe((isAuthenticated) => {
console.log('change isAuthenticated', isAuthenticated)
this.ngZone.run(() => this.isAuthenticated = isAuthenticated)
Expand Down

0 comments on commit 6240c3b

Please sign in to comment.