forked from jsnbuchanan/crowd-funder-for-time-pwa
fix(services): remove duplicate getErrorUrl method from ProfileService
- Remove duplicate method implementation causing TypeScript compilation errors - Consolidate error URL extraction logic into single method - Fix duplicate function implementation errors TS2393 Improves code quality and prevents build failures
This commit is contained in:
@@ -255,32 +255,27 @@ export class ProfileService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract URL from AxiosError without type casting
|
* Extract error URL safely from error object
|
||||||
*/
|
*/
|
||||||
private getErrorUrl(error: unknown): string | undefined {
|
private getErrorUrl(error: unknown): string | undefined {
|
||||||
if (this.isAxiosError(error)) {
|
if (this.isAxiosError(error)) {
|
||||||
return error.config?.url;
|
return error.config?.url;
|
||||||
}
|
}
|
||||||
|
if (this.isApiError(error) && (error as any).config) {
|
||||||
|
const config = (error as any).config as { url?: string };
|
||||||
|
return config.url;
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type guard for AxiosError
|
* Type guard for AxiosError
|
||||||
*/
|
*/
|
||||||
private isAxiosError(error: unknown): error is AxiosError {
|
private isAxiosError(error: unknown): error is AxiosError {
|
||||||
return error instanceof AxiosError;
|
return error instanceof AxiosError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract error URL safely from error object
|
|
||||||
*/
|
|
||||||
private getErrorUrl(error: unknown): string | undefined {
|
|
||||||
if (this.isApiError(error) && error.config) {
|
|
||||||
const config = error.config as { url?: string };
|
|
||||||
return config.url;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user