Browse Source

Migrate DeepLinkErrorView.vue to PlatformServiceMixin with Vue 3 to Options API conversion

- Convert Vue 3 Composition API to Options API with vue-facing-decorator
- Add PlatformServiceMixin for consistent database and logging patterns
- Replace logConsoleAndDb() with this.$logAndConsole() mixin method
- Remove legacy databaseUtil import dependency
- Convert computed properties to class getters
- Convert onMounted lifecycle to mounted() method
- Add comprehensive TODO with testing guidance

Technical Changes:
- useRoute/useRouter → this.$route/this.$router
- computed() refs → class getters with proper typing
- Composition API imports → vue-facing-decorator imports

Migration Status: 12% complete (11/91 components)
Passes lint checks and maintains all original functionality
pull/142/head
Matthew Raymer 17 hours ago
parent
commit
c4e959b94f
  1. 86
      src/views/DeepLinkErrorView.vue

86
src/views/DeepLinkErrorView.vue

@ -38,65 +38,91 @@
</div>
</template>
<script setup lang="ts">
import { computed, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
<script lang="ts">
// TODO: Testing Required - Vue 3 to Options API + PlatformServiceMixin Migration
// Priority: Medium | Migrated: 2025-01-06 | Author: Matthew Raymer
//
// MIGRATION DETAILS: Converted from Vue 3 Composition API to Options API for PlatformServiceMixin
// - Replaced logConsoleAndDb() with this.$logAndConsole()
// - Converted computed properties to getters
// - Converted onMounted to mounted() lifecycle hook
//
// TESTING NEEDED:
// 1. Test invalid deep link triggering (easy to test)
// 2. Verify error logging works correctly
// 3. Test error page display and navigation
// 4. Test "Report Issue" functionality
//
// Test URL: timesafari://invalid/path?param=test
import { Component, Vue } from "vue-facing-decorator";
import { VALID_DEEP_LINK_ROUTES } from "../interfaces/deepLinks";
import { logConsoleAndDb } from "../db/databaseUtil";
import { logger } from "../utils/logger";
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
const route = useRoute();
const router = useRouter();
@Component({
mixins: [PlatformServiceMixin],
})
export default class DeepLinkErrorView extends Vue {
validRoutes = VALID_DEEP_LINK_ROUTES;
// Extract error information from query params
const errorCode = computed(
() => (route.query.errorCode as string) || "UNKNOWN_ERROR",
);
const errorMessage = computed(
() =>
(route.query.message as string) ||
"The deep link you followed is invalid or not supported.",
get errorCode(): string {
return (this.$route.query.errorCode as string) || "UNKNOWN_ERROR";
}
get errorMessage(): string {
return (
(this.$route.query.message as string) ||
"The deep link you followed is invalid or not supported."
);
const originalPath = computed(() => route.query.originalPath as string);
const validRoutes = VALID_DEEP_LINK_ROUTES;
}
get originalPath(): string {
return this.$route.query.originalPath as string;
}
// Format the path and include any parameters
const formattedPath = computed(() => {
if (!originalPath.value) return "";
const path = originalPath.value.replace(/^\/+/, "");
get formattedPath(): string {
if (!this.originalPath) return "";
const path = this.originalPath.replace(/^\/+/, "");
// Log for debugging
logger.log(
"[DeepLinkError] Original Path:",
originalPath.value,
this.originalPath,
"Route Params:",
route.params,
this.$route.params,
"Route Query:",
route.query,
this.$route.query,
);
return path;
});
}
// Navigation methods
const goHome = () => router.replace({ name: "home" });
const reportIssue = () => {
goHome(): void {
this.$router.replace({ name: "home" });
}
reportIssue(): void {
// Open a support form or email
window.open(
"mailto:support@timesafari.app?subject=Invalid Deep Link&body=" +
encodeURIComponent(
`I encountered an error with a deep link: timesafari://${originalPath.value}\nError: ${errorMessage.value}`,
`I encountered an error with a deep link: timesafari://${this.originalPath}\nError: ${this.errorMessage}`,
),
);
};
}
// Log the error for analytics
onMounted(() => {
logConsoleAndDb(
`[DeepLink] Error page displayed for path: ${originalPath.value}, code: ${errorCode.value}, params: ${JSON.stringify(route.params)}`,
async mounted(): Promise<void> {
this.$logAndConsole(
`[DeepLink] Error page displayed for path: ${this.originalPath}, code: ${this.errorCode}, params: ${JSON.stringify(this.$route.params)}`,
true,
);
});
}
}
</script>
<style scoped>

Loading…
Cancel
Save