fix: Remove explicit axios declaration in ClaimAddRawView

- Remove conflicting axios!: AxiosStatic declaration
- Let Vue's axios plugin handle injection naturally
- Fix HTTP request errors in raw claim editor
- Clean up unused AxiosStatic import
- Verified build and lint success
This commit is contained in:
Matthew Raymer
2025-07-06 06:39:30 +00:00
parent 2e2d858cc9
commit db89376d4f
2 changed files with 158 additions and 6 deletions

View File

@@ -30,17 +30,16 @@
<script lang="ts">
import { Component, Vue } from "vue-facing-decorator";
import { AxiosResponse, AxiosStatic } from "axios";
import { AxiosResponse } from "axios";
import QuickNav from "../components/QuickNav.vue";
import { NotificationIface } from "../constants/app";
import * as databaseUtil from "../db/databaseUtil";
import { logConsoleAndDb } from "../db/databaseUtil";
import * as serverUtil from "../libs/endorserServer";
import * as libsUtil from "../libs/util";
import { errorStringForLog } from "../libs/endorserServer";
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
import { logger } from "../utils/logger";
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
// Type guard for API responses
function isApiResponse(response: unknown): response is AxiosResponse {
@@ -52,18 +51,39 @@ function isApiResponse(response: unknown): response is AxiosResponse {
);
}
// TODO: Testing Required - Database Operations + Logging Migration to PlatformServiceMixin
// Priority: High | Migrated: 2025-07-06 | Author: Matthew Raymer
//
// MIGRATION DETAILS: Migrated from legacy database utilities + logging to PlatformServiceMixin
// - Replaced legacy logging calls with this.$logAndConsole()
// - Replaced legacy settings retrieval with this.$accountSettings()
// - Removed legacy database and logging imports
//
// TESTING NEEDED: Raw claim editor functionality
// 1. Test basic page load: /claim-add-raw (JSON editor displays)
// 2. Test with sample JSON: /claim-add-raw?claim={"type":"example","data":"test"}
// 3. Test JSON validation (valid/invalid JSON handling)
// 4. Test claim submission functionality
// 5. Test error scenarios: network failure, invalid JSON, server errors
// 6. Verify error logging appears in console and database
// 7. Cross-platform testing: web, mobile, desktop
//
// Test URLs:
// /claim-add-raw (basic editor)
// /claim-add-raw?claim={"type":"test","data":"sample"}
/**
* View component for adding or editing raw claim data
* Allows direct JSON editing of claim data with validation and submission
*/
@Component({
components: { QuickNav },
mixins: [PlatformServiceMixin],
})
export default class ClaimAddRawView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
$route!: RouteLocationNormalizedLoaded;
$router!: Router;
axios!: AxiosStatic; // Using any to avoid type conflicts with Vue's axios property
accountIdentityStr: string = "null";
activeDid = "";
@@ -88,7 +108,7 @@ export default class ClaimAddRawView extends Vue {
* Initialize settings from active account
*/
private async initializeSettings() {
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
this.apiServer = settings.apiServer || "";
}
@@ -175,7 +195,7 @@ export default class ClaimAddRawView extends Vue {
* Handle error loading claim data
*/
private handleClaimError(error: unknown) {
logConsoleAndDb(
this.$logAndConsole(
"Error retrieving claim: " + errorStringForLog(error),
true,
);