Skip to content

Commit 177a838

Browse files
Merge pull request #101 from nullinside-development-group/feat/login
feat: making desktop login less confusing
2 parents a015459 + e71f1aa commit 177a838

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/src/app/view/login-landing-desktop/login-landing-desktop.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ export class LoginLandingDesktopComponent implements OnInit {
6464
expiresUtc: oAuth.expiresUtc
6565
};
6666

67-
this.desktopData = JSON.stringify(oAuth);
68-
navigator.clipboard.writeText(this.desktopData);
69-
this.loading = false;
70-
this.timer?.unsubscribe();
67+
// DO NOT assign this.desktopData until AFTER you update the clipboard successfully.
68+
// The absence of a value on this.desktopData is what tells the application we haven't logged in yet.
69+
const json = JSON.stringify(oAuth);
70+
navigator.clipboard.writeText(json);
71+
this.desktopData = json;
7172

73+
this.loading = false;
7274
this.timer = interval(1000)
7375
.subscribe({
7476
next: _ => {
@@ -89,7 +91,7 @@ export class LoginLandingDesktopComponent implements OnInit {
8991
try {
9092
navigator.clipboard.readText().then(text => {
9193
// If the text matches what we put on the clipboard then we aren't signed in yet.
92-
if (text === this.desktopData) {
94+
if (undefined === this.desktopData || text === this.desktopData) {
9395
return;
9496
}
9597

0 commit comments

Comments
 (0)