This repository has been archived on 2025-06-10. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
server/frontend/ui/src/stores/challengeinfo.js

22 lines
498 B
JavaScript

import { readable, writable } from 'svelte/store';
function createChallengeStore() {
const { subscribe, set, update } = writable({});
return {
subscribe,
update: (res_challenge, cb) => {
if (res_challenge.status === 200) {
res_challenge.json().then((challenge) => {
update((s) => (Object.assign({}, challenge)));
if (cb) {
cb(challenge);
}
});
}
},
}
}
export const challengeInfo = createChallengeStore();