refactored more error code
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { error, yikes } from '../../warn.svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import TypeSelector from './TypeSelector.svelte';
|
||||
|
||||
let error = null;
|
||||
let companies = {};
|
||||
let router = useTinyRouter();
|
||||
let company_id = +router.query.company_id;
|
||||
@@ -28,7 +28,7 @@
|
||||
if (resp.ok){
|
||||
load(selected_company); // relaod docs
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
if (resp.ok){
|
||||
documents = await resp.json();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,9 @@
|
||||
const resp = await fetch(url,{ credentials: 'include'});
|
||||
if (resp.ok){
|
||||
companies = await resp.json();
|
||||
yikes();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
error(resp);
|
||||
}
|
||||
if (company_id) {
|
||||
for (let comp of Object.values(companies)){
|
||||
|
||||
Reference in New Issue
Block a user