Surface dxf_warning from scad_save/scad_save_new as a toast
This commit is contained in:
parent
f471e0245a
commit
1c7f05f404
1 changed files with 5 additions and 1 deletions
|
|
@ -42,7 +42,11 @@ async function saveToCmms(model: any, toast: React.RefObject<Toast>) {
|
||||||
const data = await resp.json();
|
const data = await resp.json();
|
||||||
if (!resp.ok || !data.ok) throw new Error(data.error || `HTTP ${resp.status}`);
|
if (!resp.ok || !data.ok) throw new Error(data.error || `HTTP ${resp.status}`);
|
||||||
if (data.id) cfg.attachmentId = String(data.id);
|
if (data.id) cfg.attachmentId = String(data.id);
|
||||||
toast.current?.show({severity: 'success', summary: 'Saved to CMMS', life: 3000});
|
if (data.dxf_warning) {
|
||||||
|
toast.current?.show({severity: 'warn', summary: 'Saved, but the DXF companion could not be regenerated', detail: String(data.dxf_warning), life: 8000});
|
||||||
|
} else {
|
||||||
|
toast.current?.show({severity: 'success', summary: 'Saved to CMMS', life: 3000});
|
||||||
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
toast.current?.show({severity: 'error', summary: 'Save failed', detail: String(e?.message ?? e), life: 6000});
|
toast.current?.show({severity: 'error', summary: 'Save failed', detail: String(e?.message ?? e), life: 6000});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue