wirking on global error display
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<script>
|
||||
import {onMount} from 'svelte';
|
||||
import {api} from '../../urls.svelte.js';
|
||||
import {t} from '../../translations.svelte.js';
|
||||
import {api} from '../../urls.svelte';
|
||||
import { error, yikes } from '../../warn.svelte';
|
||||
import {t} from '../../translations.svelte';
|
||||
|
||||
import Editor from './Editor.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import Notes from '../notes/RelatedNotes.svelte';
|
||||
|
||||
let error = $state(null);
|
||||
let companies = $state(null);
|
||||
let new_company = $state({name:null,email:null});
|
||||
let selected = $state(0);
|
||||
@@ -23,9 +23,9 @@
|
||||
if (resp.ok){
|
||||
const company = await resp.json();
|
||||
companies[company.id] = company;
|
||||
error = null;
|
||||
yikes();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(await resp.text())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
});
|
||||
if (resp.ok){
|
||||
delete companies[company.id];
|
||||
error = null;
|
||||
yikes();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(await resp.text());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -50,9 +50,9 @@
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
companies = await resp.json();
|
||||
error = null;
|
||||
yikes();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(await resp.text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@
|
||||
<legend>
|
||||
{t('companies')}
|
||||
</legend>
|
||||
{#if error}
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
{#if companies}
|
||||
<table class="companies">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user