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 61da40596c
commit 03178d35e7
56 changed files with 581 additions and 251 deletions

View File

@@ -136,7 +136,10 @@
/>
<span v-if="offer.amountGiven >= offer.amount">
<font-awesome icon="check-circle" class="fa-fw text-green-500" />
<font-awesome
icon="check-circle"
class="fa-fw text-green-500"
/>
All {{ offer.amount }} given
</span>
<span v-else>
@@ -176,7 +179,10 @@
<span v-else>
<!-- Non-amount offer -->
<span v-if="offer.nonAmountGivenConfirmed">
<font-awesome icon="check-circle" class="fa-fw text-green-500" />
<font-awesome
icon="check-circle"
class="fa-fw text-green-500"
/>
{{ offer.nonAmountGivenConfirmed }}
{{ offer.nonAmountGivenConfirmed == 1 ? "give" : "gives" }}
are confirmed.
@@ -295,7 +301,9 @@ import { OnboardPage } from "../libs/util";
})
export default class ProjectsView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
errNote(message) {
$router!: Router;
errNote(message: string) {
this.$notify(
{ group: "alert", type: "danger", title: "Error", text: message },
5000,
@@ -417,7 +425,7 @@ export default class ProjectsView extends Vue {
const route = {
path: "/project/" + encodeURIComponent(id),
};
(this.$router as Router).push(route);
this.$router.push(route);
}
/**
@@ -427,14 +435,14 @@ export default class ProjectsView extends Vue {
const route = {
name: "new-edit-project",
};
(this.$router as Router).push(route);
this.$router.push(route);
}
onClickLoadClaim(jwtId: string) {
const route = {
path: "/claim/" + encodeURIComponent(jwtId),
};
(this.$router as Router).push(route);
this.$router.push(route);
}
/**
@@ -537,10 +545,10 @@ export default class ProjectsView extends Vue {
text: "If so, we'll use those with QR codes to share.",
onCancel: async () => {},
onNo: async () => {
(this.$router as Router).push({ name: "share-my-contact-info" });
this.$router.push({ name: "share-my-contact-info" });
},
onYes: async () => {
(this.$router as Router).push({ name: "contact-qr" });
this.$router.push({ name: "contact-qr" });
},
noText: "we will share another way",
yesText: "we are nearby with cameras",