forked from jsnbuchanan/crowd-funder-for-time-pwa
chore: clean up debug logging
This commit is contained in:
@@ -124,17 +124,12 @@ export class ProfileService {
|
|||||||
async deleteProfile(activeDid: string): Promise<boolean> {
|
async deleteProfile(activeDid: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const headers = await getHeaders(activeDid);
|
const headers = await getHeaders(activeDid);
|
||||||
logger.debug("Attempting to delete profile for DID:", activeDid);
|
const response = await this.axios.delete(
|
||||||
logger.debug("Using partner API server:", this.partnerApiServer);
|
`${this.partnerApiServer}/api/partner/userProfile`,
|
||||||
logger.debug("Request headers:", headers);
|
{ headers },
|
||||||
|
);
|
||||||
const url = `${this.partnerApiServer}/api/partner/userProfile`;
|
|
||||||
logger.debug("DELETE request URL:", url);
|
|
||||||
|
|
||||||
const response = await this.axios.delete(url, { headers });
|
|
||||||
|
|
||||||
if (response.status === 200 || response.status === 204) {
|
if (response.status === 200 || response.status === 204) {
|
||||||
logger.debug("Profile deleted successfully");
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
logger.error("Unexpected response status when deleting profile:", {
|
logger.error("Unexpected response status when deleting profile:", {
|
||||||
@@ -156,7 +151,6 @@ export class ProfileService {
|
|||||||
|
|
||||||
// Handle specific HTTP status codes
|
// Handle specific HTTP status codes
|
||||||
if (response.status === 204) {
|
if (response.status === 204) {
|
||||||
logger.debug("Profile deleted successfully (204 No Content)");
|
|
||||||
return true; // 204 is success for DELETE operations
|
return true; // 204 is success for DELETE operations
|
||||||
} else if (response.status === 404) {
|
} else if (response.status === 404) {
|
||||||
logger.warn("Profile not found - may already be deleted");
|
logger.warn("Profile not found - may already be deleted");
|
||||||
|
|||||||
@@ -182,7 +182,6 @@
|
|||||||
@change="onLocationCheckboxChange"
|
@change="onLocationCheckboxChange"
|
||||||
/>
|
/>
|
||||||
<label for="includeUserProfileLocation">Include Location</label>
|
<label for="includeUserProfileLocation">Include Location</label>
|
||||||
<span class="text-xs text-slate-400 ml-2">(Debug: {{ isMapReady ? 'Map Ready' : 'Map Loading' }})</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="includeUserProfileLocation" class="mb-4 aspect-video">
|
<div v-if="includeUserProfileLocation" class="mb-4 aspect-video">
|
||||||
<p class="text-sm mb-2 text-slate-500">
|
<p class="text-sm mb-2 text-slate-500">
|
||||||
@@ -1541,14 +1540,12 @@ export default class AccountViewView extends Vue {
|
|||||||
|
|
||||||
onMapReady(map: L.Map): void {
|
onMapReady(map: L.Map): void {
|
||||||
try {
|
try {
|
||||||
logger.debug("Map ready event fired, map object:", map);
|
|
||||||
// doing this here instead of on the l-map element avoids a recentering after a drag then zoom at startup
|
// doing this here instead of on the l-map element avoids a recentering after a drag then zoom at startup
|
||||||
const zoom = this.userProfileLatitude && this.userProfileLongitude ? 12 : 2;
|
const zoom = this.userProfileLatitude && this.userProfileLongitude ? 12 : 2;
|
||||||
const lat = this.userProfileLatitude || 0;
|
const lat = this.userProfileLatitude || 0;
|
||||||
const lng = this.userProfileLongitude || 0;
|
const lng = this.userProfileLongitude || 0;
|
||||||
map.setView([lat, lng], zoom);
|
map.setView([lat, lng], zoom);
|
||||||
this.isMapReady = true;
|
this.isMapReady = true;
|
||||||
logger.debug("Map ready state set to true, coordinates:", [lat, lng], "zoom:", zoom);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error in onMapReady:", error);
|
logger.error("Error in onMapReady:", error);
|
||||||
this.isMapReady = true; // Set to true even on error to prevent infinite loading
|
this.isMapReady = true; // Set to true even on error to prevent infinite loading
|
||||||
@@ -1556,27 +1553,18 @@ export default class AccountViewView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMapMounted(): void {
|
onMapMounted(): void {
|
||||||
logger.debug("Map component mounted");
|
|
||||||
// Check if map ref is available
|
|
||||||
const mapRef = this.$refs.profileMap;
|
|
||||||
logger.debug("Map ref:", mapRef);
|
|
||||||
|
|
||||||
// Try to set map ready after component is mounted
|
// Try to set map ready after component is mounted
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isMapReady = true;
|
this.isMapReady = true;
|
||||||
logger.debug("Map ready set to true after mounted");
|
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback method to handle map initialization failures
|
// Fallback method to handle map initialization failures
|
||||||
private handleMapInitFailure(): void {
|
private handleMapInitFailure(): void {
|
||||||
logger.debug("Starting map initialization timeout (5 seconds)");
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.isMapReady) {
|
if (!this.isMapReady) {
|
||||||
logger.warn("Map failed to initialize, forcing ready state");
|
logger.warn("Map failed to initialize, forcing ready state");
|
||||||
this.isMapReady = true;
|
this.isMapReady = true;
|
||||||
} else {
|
|
||||||
logger.debug("Map initialized successfully, timeout not needed");
|
|
||||||
}
|
}
|
||||||
}, 5000); // 5 second timeout
|
}, 5000); // 5 second timeout
|
||||||
}
|
}
|
||||||
@@ -1598,8 +1586,6 @@ export default class AccountViewView extends Vue {
|
|||||||
includeLocation: this.includeUserProfileLocation,
|
includeLocation: this.includeUserProfileLocation,
|
||||||
};
|
};
|
||||||
|
|
||||||
logger.debug("Saving profile data:", profileData);
|
|
||||||
|
|
||||||
const success = await this.profileService.saveProfile(
|
const success = await this.profileService.saveProfile(
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
profileData,
|
profileData,
|
||||||
@@ -1664,7 +1650,6 @@ export default class AccountViewView extends Vue {
|
|||||||
|
|
||||||
async deleteProfile(): Promise<void> {
|
async deleteProfile(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
logger.debug("Attempting to delete profile for DID:", this.activeDid);
|
|
||||||
const success = await this.profileService.deleteProfile(this.activeDid);
|
const success = await this.profileService.deleteProfile(this.activeDid);
|
||||||
if (success) {
|
if (success) {
|
||||||
this.notify.success(ACCOUNT_VIEW_CONSTANTS.SUCCESS.PROFILE_DELETED);
|
this.notify.success(ACCOUNT_VIEW_CONSTANTS.SUCCESS.PROFILE_DELETED);
|
||||||
@@ -1673,7 +1658,6 @@ export default class AccountViewView extends Vue {
|
|||||||
this.userProfileLongitude = 0;
|
this.userProfileLongitude = 0;
|
||||||
this.includeUserProfileLocation = false;
|
this.includeUserProfileLocation = false;
|
||||||
this.isMapReady = false; // Reset map state
|
this.isMapReady = false; // Reset map state
|
||||||
logger.debug("Profile deleted successfully, UI state reset");
|
|
||||||
} else {
|
} else {
|
||||||
this.notify.error(ACCOUNT_VIEW_CONSTANTS.ERRORS.PROFILE_DELETE_ERROR);
|
this.notify.error(ACCOUNT_VIEW_CONSTANTS.ERRORS.PROFILE_DELETE_ERROR);
|
||||||
}
|
}
|
||||||
@@ -1710,22 +1694,18 @@ export default class AccountViewView extends Vue {
|
|||||||
|
|
||||||
onLocationCheckboxChange(): void {
|
onLocationCheckboxChange(): void {
|
||||||
try {
|
try {
|
||||||
logger.debug("Location checkbox changed, new value:", this.includeUserProfileLocation);
|
|
||||||
if (!this.includeUserProfileLocation) {
|
if (!this.includeUserProfileLocation) {
|
||||||
// Location checkbox was unchecked, clean up map state
|
// Location checkbox was unchecked, clean up map state
|
||||||
this.isMapReady = false;
|
this.isMapReady = false;
|
||||||
this.userProfileLatitude = 0;
|
this.userProfileLatitude = 0;
|
||||||
this.userProfileLongitude = 0;
|
this.userProfileLongitude = 0;
|
||||||
logger.debug("Location unchecked, map state reset");
|
|
||||||
} else {
|
} else {
|
||||||
// Location checkbox was checked, start map initialization timeout
|
// Location checkbox was checked, start map initialization timeout
|
||||||
this.isMapReady = false;
|
this.isMapReady = false;
|
||||||
logger.debug("Location checked, starting map initialization timeout");
|
|
||||||
|
|
||||||
// Try to set map ready after a short delay to allow Vue to render
|
// Try to set map ready after a short delay to allow Vue to render
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.isMapReady) {
|
if (!this.isMapReady) {
|
||||||
logger.debug("Setting map ready after timeout");
|
|
||||||
this.isMapReady = true;
|
this.isMapReady = true;
|
||||||
}
|
}
|
||||||
}, 1000); // 1 second delay
|
}, 1000); // 1 second delay
|
||||||
|
|||||||
Reference in New Issue
Block a user