@@ -5,8 +5,8 @@ import AccountView from './AccountView.vue';
55import CydAPIClient from ' ../../../cyd-api-client' ;
66import type { DeviceInfo } from ' ../types' ;
77import type { Account } from ' ../../../shared_types' ;
8- import ManageAccountView from ' ./ManageAccountView.vue' ;
98import AboutView from ' ./AboutView.vue' ;
9+ import { openURL } from ' ../util' ;
1010
1111// Get the global emitter
1212const vueInstance = getCurrentInstance ();
@@ -24,12 +24,10 @@ const refreshDeviceInfo = inject('refreshDeviceInfo') as () => Promise<void>;
2424const refreshAPIClient = inject (' refreshAPIClient' ) as () => Promise <void >;
2525
2626const hideAllAccounts = ref (false );
27- const showManageAccount = ref (false );
2827
2928const showAbout = ref (false );
3029
3130const accountClicked = async (account : Account ) => {
32- hideManageAccountView ();
3331 hideAboutView ();
3432
3533 activeAccountID .value = account .id ;
@@ -48,7 +46,6 @@ const accountClicked = async (account: Account) => {
4846};
4947
5048const addAccountClicked = async () => {
51- hideManageAccountView ();
5249 hideAboutView ();
5350
5451 // Do we already have an unknown account?
@@ -91,7 +88,6 @@ const removeAccount = async (accountID: number) => {
9188}
9289
9390const accountSelected = async (account : Account , accountType : string ) => {
94- hideManageAccountView ();
9591 hideAboutView ();
9692
9793 try {
@@ -131,44 +127,27 @@ const outsideUserMenuClicked = (event: MouseEvent) => {
131127 }
132128};
133129
134- const showManageAccountView = () => {
130+ const openDashboard = async () => {
135131 userBtnShowMenu .value = false ;
136132
137- showManageAccount .value = true ;
138- showAbout .value = false ;
139- hideAllAccounts .value = true ;
140- };
141-
142- const hideManageAccountView = () => {
143- showManageAccount .value = false ;
144- showAbout .value = false ;
145- hideAllAccounts .value = false ;
133+ const dashURL = await window .electron .getDashURL ();
134+ const nativeLoginURL = ` ${dashURL }/#/native-login/${deviceInfo .value ?.userEmail }/${deviceInfo .value ?.deviceToken }/manage ` ;
135+ openURL (nativeLoginURL );
146136};
147137
148- emitter ?.on (' show-manage-account' , showManageAccountView );
138+ emitter ?.on (' show-manage-account' , openDashboard );
149139
150140const manageAccountClicked = async () => {
151- localStorage .setItem (' manageAccountMode' , ' manage' );
152- showManageAccountView ();
153- };
154-
155- const redirectToAccount = (accountID : number ) => {
156- // This forces the account to re-check if the user is signed in and if premium is enabled
157- emitter ?.emit (' signed-in' );
158-
159- activeAccountID .value = accountID ;
160- hideManageAccountView ();
141+ openDashboard ();
161142};
162143
163144const showAboutView = () => {
164145 userBtnShowMenu .value = false ;
165- showManageAccount .value = false ;
166146 showAbout .value = true ;
167147 hideAllAccounts .value = true ;
168148};
169149
170150const hideAboutView = () => {
171- showManageAccount .value = false ;
172151 showAbout .value = false ;
173152 hideAllAccounts .value = false ;
174153};
@@ -178,7 +157,6 @@ const aboutClicked = async () => {
178157};
179158
180159const signInClicked = async () => {
181- localStorage .setItem (' manageAccountMode' , ' manage' );
182160 emitter ?.emit (' show-sign-in' );
183161};
184162
@@ -207,12 +185,9 @@ const signOutClicked = async () => {
207185 await refreshDeviceInfo ();
208186 await refreshAPIClient ();
209187
210- showManageAccount .value = false ;
211188 userBtnShowMenu .value = false ;
212189
213190 emitter ?.emit (' signed-out' );
214-
215- hideManageAccountView ();
216191};
217192
218193const checkForUpdatesClicked = async () => {
@@ -242,7 +217,7 @@ onMounted(async () => {
242217 document .addEventListener (' click' , outsideUserMenuClicked );
243218 document .addEventListener (' auxclick' , outsideUserMenuClicked );
244219
245- emitter ?.on (' signed-in' , showManageAccountView );
220+ emitter ?.on (' signed-in' , openDashboard );
246221 emitter ?.on (' account-updated' , reloadAccounts );
247222});
248223
@@ -339,9 +314,6 @@ onUnmounted(async () => {
339314 :class =" { 'hide': hideAllAccounts || activeAccountID !== account.id }" @account-selected =" accountSelected"
340315 @on-remove-clicked =" removeAccount(account.id)" />
341316
342- <!-- Manay my Cyd account -->
343- <ManageAccountView :should-show =" showManageAccount" @redirect-to-account =" redirectToAccount" />
344-
345317 <!-- About -->
346318 <AboutView :should-show =" showAbout" />
347319 </div >
0 commit comments