forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor: improve router type safety and usage
- Add explicit Router type imports across views - Replace $router type casting with proper typing - Use $router.back() instead of $router.go(-1) for consistency - Add proper route and router typings to components - Clean up router navigation methods - Fix router push/back method calls This commit improves type safety and consistency in router usage across the application's view components.
This commit is contained in:
@@ -22,7 +22,10 @@
|
||||
v-if="activeDid && !activeDidInIdentities"
|
||||
class="block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4"
|
||||
>
|
||||
<font-awesome icon="circle-check" class="fa-fw text-red-600 text-xl mr-3"></font-awesome>
|
||||
<font-awesome
|
||||
icon="circle-check"
|
||||
class="fa-fw text-red-600 text-xl mr-3"
|
||||
></font-awesome>
|
||||
<div class="text-sm text-slate-500">
|
||||
<div class="overflow-hidden truncate">
|
||||
<b>ID:</b> <code>{{ activeDid }}</code>
|
||||
@@ -114,6 +117,7 @@ import { retrieveAllAccountsMetadata } from "../libs/util";
|
||||
@Component({ components: { QuickNav } })
|
||||
export default class IdentitySwitcherView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$router!: Router;
|
||||
|
||||
public activeDid = "";
|
||||
public activeDidInIdentities = false;
|
||||
@@ -131,7 +135,10 @@ export default class IdentitySwitcherView extends Vue {
|
||||
const accounts = await retrieveAllAccountsMetadata();
|
||||
for (let n = 0; n < accounts.length; n++) {
|
||||
const acct = accounts[n];
|
||||
this.otherIdentities.push({ id: acct.id as string, did: acct.did });
|
||||
this.otherIdentities.push({
|
||||
id: (acct.id ?? 0).toString(),
|
||||
did: acct.did,
|
||||
});
|
||||
if (acct.did && this.activeDid === acct.did) {
|
||||
this.activeDidInIdentities = true;
|
||||
}
|
||||
@@ -159,7 +166,7 @@ export default class IdentitySwitcherView extends Vue {
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
activeDid: did,
|
||||
});
|
||||
(this.$router as Router).push({ name: "account" });
|
||||
this.$router.push({ name: "account" });
|
||||
}
|
||||
|
||||
async deleteAccount(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user