Cleanup frontend
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2022-04-19 22:07:43 +02:00
parent 63875a6f59
commit cb8400eea3
17 changed files with 4526 additions and 3763 deletions

View File

@@ -1,5 +1,11 @@
import { readonly, ref } from 'vue';
import { readonly, Ref, ref } from 'vue';
/**
* Random labels as a library function.
* Will return a random label from the given options.
* Calling the `update` function that is returned will pick a new label.
* @param options
*/
export function randomLabel(options: string[]) {
const label = ref<string>();
const randomLabel = () => {
@@ -12,7 +18,11 @@ export function randomLabel(options: string[]) {
label.value = randomLabel();
return {
label: readonly(label),
update: () => (label.value = randomLabel()),
// This type refinement is proper as the `undefined` value can never happen from this point onwards
label: readonly(label as Ref<string>),
// Updates the returned `label` with a new randomly chosen one
update() {
label.value = randomLabel();
},
};
}