fix share to users UI
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m22s
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m22s
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface MapShareLink {
|
||||
}
|
||||
|
||||
export interface CreateMapShare {
|
||||
user_id: string;
|
||||
user_identifier: string;
|
||||
permission: 'read' | 'edit';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user