qa: Back to the same situation

This commit is contained in:
nemunaire 2022-11-07 01:00:04 +01:00
commit 1aa82bb2ef
27 changed files with 1336 additions and 22 deletions

View file

@ -0,0 +1,29 @@
import { writable, derived } from 'svelte/store';
function createVersionStore() {
const { subscribe, set, update } = writable({"auth":null});
return {
subscribe,
set: (v) => {
update((m) => Object.assign(m, v));
},
update,
refresh: async () => {
const version = await (await fetch('api/version', {headers: {'Accept': 'application/json'}})).json()
update((m) => version);
return version;
},
};
}
export const version = createVersionStore();
export const auth = derived(
version,
$version => $version.auth,
);

View file

@ -0,0 +1,39 @@
import { writable, derived } from 'svelte/store';
import { getExercices } from '$lib/exercices'
function createExercicesStore() {
const { subscribe, set, update } = writable([]);
return {
subscribe,
set: (v) => {
update((m) => Object.assign(m, v));
},
update,
refresh: async () => {
const list = await getExercices();
update((m) => list);
return list;
},
};
}
export const exercices = createExercicesStore();
export const exercicesIdx = derived(
exercices,
$exercices => {
const exercices_idx = { };
for (const e of $exercices) {
exercices_idx[e.id] = e;
}
return exercices_idx;
},
);

View file

@ -0,0 +1,39 @@
import { writable, derived } from 'svelte/store';
import { getThemes } from '$lib/themes'
function createThemesStore() {
const { subscribe, set, update } = writable([]);
return {
subscribe,
set: (v) => {
update((m) => Object.assign(m, v));
},
update,
refresh: async () => {
const list = await getThemes();
update((m) => list);
return list;
},
};
}
export const themes = createThemesStore();
export const themesIdx = derived(
themes,
$themes => {
const themes_idx = { };
for (const t of $themes) {
themes_idx[t.id] = t;
}
return themes_idx;
},
);

View file

@ -0,0 +1,26 @@
import { writable } from 'svelte/store';
import { getQAWork } from '$lib/todo'
function createTodosStore() {
const { subscribe, set, update } = writable([]);
return {
subscribe,
set: (v) => {
update((m) => Object.assign(m, v));
},
update,
refresh: async () => {
const list = await getQAWork();
update((m) => list);
return list;
},
};
}
export const todos = createTodosStore();