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:
Matthew Raymer
2025-02-26 06:50:08 +00:00
parent a2e19d7e9a
commit f6802cd160
56 changed files with 581 additions and 251 deletions

View File

@@ -44,7 +44,10 @@
</span>
{{ givenName }}
<router-link :to="{ name: 'new-edit-account' }">
<font-awesome icon="pen" class="text-xs text-blue-500 ml-2 mb-1"></font-awesome>
<font-awesome
icon="pen"
class="text-xs text-blue-500 ml-2 mb-1"
></font-awesome>
</router-link>
</h2>
</div>
@@ -268,8 +271,11 @@
class="bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8"
>
<div v-if="loadingProfile" class="text-center mb-2">
<font-awesome icon="spinner" class="fa-spin text-slate-400"></font-awesome> Loading
profile...
<font-awesome
icon="spinner"
class="fa-spin text-slate-400"
></font-awesome>
Loading profile...
</div>
<div v-else class="flex items-center mb-2">
<span class="font-bold">Public Profile</span>
@@ -363,7 +369,8 @@
<div class="mb-2 font-bold">Usage Limits</div>
<!-- show spinner if loading limits -->
<div v-if="loadingLimits" class="text-center">
Checking&hellip; <font-awesome icon="spinner" class="fa-spin"></font-awesome>
Checking&hellip;
<font-awesome icon="spinner" class="fa-spin"></font-awesome>
</div>
<div class="mb-4 text-center">
{{ limitsMessage }}
@@ -494,7 +501,10 @@
"
class="ml-2"
>
<font-awesome icon="copy" class="text-slate-400 fa-fw"></font-awesome>
<font-awesome
icon="copy"
class="text-slate-400 fa-fw"
></font-awesome>
</button>
<span v-show="showB64Copy">Copied</span>
</div>
@@ -510,7 +520,10 @@
"
class="ml-2"
>
<font-awesome icon="copy" class="text-slate-400 fa-fw"></font-awesome>
<font-awesome
icon="copy"
class="text-slate-400 fa-fw"
></font-awesome>
</button>
<span v-show="showPubCopy">Copied</span>
</div>
@@ -530,7 +543,10 @@
"
class="ml-2"
>
<font-awesome icon="copy" class="text-slate-400 fa-fw"></font-awesome>
<font-awesome
icon="copy"
class="text-slate-400 fa-fw"
></font-awesome>
</button>
<span v-show="showDerCopy">Copied</span>
</div>
@@ -631,7 +647,11 @@
class="w-full px-4 rounded bg-yellow-500 border border-slate-400"
@click="onClickSaveApiServer()"
>
<font-awesome icon="floppy-disk" class="fa-fw" color="white"></font-awesome>
<font-awesome
icon="floppy-disk"
class="fa-fw"
color="white"
></font-awesome>
</button>
<button
class="px-3 rounded bg-slate-200 border border-slate-400"
@@ -708,7 +728,11 @@
class="w-full px-4 rounded bg-yellow-500 border border-slate-400"
@click="onClickSavePushServer()"
>
<font-awesome icon="floppy-disk" class="fa-fw" color="white"></font-awesome>
<font-awesome
icon="floppy-disk"
class="fa-fw"
color="white"
></font-awesome>
</button>
<button
class="px-3 rounded bg-slate-200 border border-slate-400"
@@ -747,7 +771,11 @@
class="w-full px-4 rounded bg-yellow-500 border border-slate-400"
@click="onClickSavePartnerServer()"
>
<font-awesome icon="floppy-disk" class="fa-fw" color="white"></font-awesome>
<font-awesome
icon="floppy-disk"
class="fa-fw"
color="white"
></font-awesome>
</button>
<button
class="px-3 rounded bg-slate-200 border border-slate-400"
@@ -901,7 +929,7 @@ import * as R from "ramda";
import { IIdentifier } from "@veramo/core";
import { ref } from "vue";
import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
import { useClipboard } from "@vueuse/core";
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
@@ -947,6 +975,7 @@ import {
DIRECT_PUSH_TITLE,
retrieveAccountMetadata,
} from "../libs/util";
import { UserProfile } from "@/libs/partnerServer";
const inputImportFileNameRef = ref<Blob>();
@@ -966,6 +995,8 @@ const inputImportFileNameRef = ref<Blob>();
})
export default class AccountViewView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
$route!: RouteLocationNormalizedLoaded;
$router!: Router;
AppConstants = AppString;
DEFAULT_PUSH_SERVER = DEFAULT_PUSH_SERVER;