Skip to content

Commit 760bf53

Browse files
committed
fix - calling userInfo when not logged in by snippet details
1 parent d99843a commit 760bf53

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

documentation/temp/to-do.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@
1313
(click)="shareSnippetDialog(snippet, observables.userIsLoggedIn, observables.userId)"><i class="fas fa-share"></i> Share
1414
</button>
1515

16-
* error userinfo in console network when NOT logged in http://localhost:4200/snippets/shared/0a77563c-afed-4b01-af83-52348653e844
1716

18-
* public snippets test not working - see console (results are present but not shown and public bookmarks are searched in...)

frontend/src/app/shared/snippet-details/snippet-details.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class SnippetDetailsComponent implements OnInit, OnChanges {
2828
snippet: Snippet;
2929

3030
userId$: Observable<string>;
31-
userIsLoggedIn$: Observable<boolean>;
31+
userIsLoggedIn = false;
3232

3333
source: string; // "public" or "personal"
3434

@@ -64,8 +64,13 @@ export class SnippetDetailsComponent implements OnInit, OnChanges {
6464
}
6565

6666
ngOnInit(): void {
67-
this.userIsLoggedIn$ = fromPromise(this.keycloakService.isLoggedIn());
68-
this.userId$ = this.userInfoStore.getUserId$();
67+
this.keycloakService.isLoggedIn().then(isLoggedIn => {
68+
if (isLoggedIn) {
69+
this.userIsLoggedIn = true;
70+
this.userId$ = this.userInfoStore.getUserId$();
71+
}
72+
});
73+
// this.userId$ = this.userInfoStore.getUserId$();
6974

7075
this.metaService.updateTag({
7176
property: 'og:image',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Codever",
3-
"version": "7.2.1",
3+
"version": "7.2.2",
44
"description": "Codever - bookmarks, snippets and notes manager for developers & co",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",

0 commit comments

Comments
 (0)