code cleanup
This commit is contained in:
@@ -1,16 +1,23 @@
|
||||
<script>
|
||||
import {onMount} from 'svelte';
|
||||
import {t} from '../../translations.svelte.js';
|
||||
let { caption = t('select_state'), selected = $bindable(0), onchange = (val) => console.log('changed to '+val)} = $props();
|
||||
|
||||
import {api} from '../../urls.svelte.js';
|
||||
import {t} from '../../translations.svelte.js';
|
||||
|
||||
let {
|
||||
caption = t('select_state'),
|
||||
onchange = (val) => console.log('changed to '+val),
|
||||
selected = $bindable(0)
|
||||
} = $props();
|
||||
|
||||
let message = $state(t('loading'));
|
||||
let states = $state(null);
|
||||
let states = $state(null);
|
||||
|
||||
async function loadStates(){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/document/states`;
|
||||
var resp = await fetch(url,{credentials: 'include'});
|
||||
const url = api('document/states');
|
||||
const resp = await fetch(url,{credentials: 'include'});
|
||||
if (resp.ok){
|
||||
states = await resp.json();
|
||||
states = await resp.json();
|
||||
} else {
|
||||
message = await resp.text();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user