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:
@@ -8,7 +8,7 @@
|
||||
<!-- Cancel -->
|
||||
<!-- Back -->
|
||||
<button
|
||||
@click="$router.go(-1)"
|
||||
@click="$router.back()"
|
||||
class="text-lg text-center px-2 py-1 absolute -left-2 -top-1"
|
||||
>
|
||||
<font-awesome icon="chevron-left" class="fa-fw"></font-awesome>
|
||||
@@ -267,6 +267,9 @@ import { serializeEvent } from "nostr-tools/lib/esm/index.js";
|
||||
})
|
||||
export default class NewEditProjectView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$route!: RouteLocationNormalizedLoaded;
|
||||
$router!: Router;
|
||||
|
||||
errNote(message: string) {
|
||||
this.$notify(
|
||||
{ group: "alert", type: "danger", title: "Error", text: message },
|
||||
@@ -312,8 +315,7 @@ export default class NewEditProjectView extends Vue {
|
||||
this.apiServer = settings.apiServer || "";
|
||||
this.showGeneralAdvanced = !!settings.showGeneralAdvanced;
|
||||
|
||||
this.projectId =
|
||||
(this.$route as RouteLocationNormalizedLoaded).query["projectId"] || "";
|
||||
this.projectId = (this.$route.query["projectId"] as string) || "";
|
||||
|
||||
if (this.projectId) {
|
||||
if (this.numAccounts === 0) {
|
||||
@@ -598,7 +600,7 @@ export default class NewEditProjectView extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
(this.$router as Router).push({ path: "/project/" + projectPath });
|
||||
this.$router.push({ path: "/project/" + projectPath });
|
||||
} else {
|
||||
console.error(
|
||||
"Got unexpected 'data' inside response from server",
|
||||
@@ -816,7 +818,7 @@ export default class NewEditProjectView extends Vue {
|
||||
}
|
||||
|
||||
public onCancelClick() {
|
||||
(this.$router as Router).back();
|
||||
this.$router.back();
|
||||
}
|
||||
|
||||
public showNostrPartnerInfo() {
|
||||
|
||||
Reference in New Issue
Block a user