fix share to users UI
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m22s

This commit is contained in:
2025-12-13 16:48:03 +05:00
parent 42bca3d114
commit 0e436aac26
2 changed files with 16 additions and 3 deletions

View File

@@ -51,7 +51,7 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
setLoading(true);
try {
await mapShareService.shareWithUser(mapId, {
user_id: newUserId.trim(),
user_identifier: newUserId.trim(),
permission: newUserPermission,
});
setNewUserId('');
@@ -59,7 +59,20 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
showToast('Map shared successfully!', 'success');
} catch (error: any) {
console.error('Share error:', error);
const message = error.response?.data?.detail || error.message || 'Failed to share map';
let message = 'Failed to share map';
if (error.response?.data?.detail) {
const detail = error.response.data.detail;
// Handle FastAPI validation errors (array of objects)
if (Array.isArray(detail)) {
message = detail.map((err: any) => err.msg).join(', ');
} else if (typeof detail === 'string') {
message = detail;
}
} else if (error.message) {
message = error.message;
}
showToast(message, 'error');
} finally {
setLoading(false);

View File

@@ -23,7 +23,7 @@ export interface MapShareLink {
}
export interface CreateMapShare {
user_id: string;
user_identifier: string;
permission: 'read' | 'edit';
}