mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-27 20:58:01 +02:00
Switched to Pinia, Added Save for Albums
This commit is contained in:
parent
a43b0907e2
commit
f303f91108
25 changed files with 945 additions and 799 deletions
44
src/stores/results.js
Normal file
44
src/stores/results.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { ref, reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useResults = defineStore('results', () => {
|
||||
const items = ref({}),
|
||||
search = ref('');
|
||||
|
||||
function setItem(key, val) {
|
||||
items.value[key] = val;
|
||||
console.log(items.value);
|
||||
}
|
||||
|
||||
function resetItems() {
|
||||
for (let i in items.value) {
|
||||
items.value[i] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return { items, search, setItem, resetItems };
|
||||
});
|
||||
|
||||
export const useArtist = defineStore('artist', () => {
|
||||
const state = reactive({
|
||||
playlistId: null,
|
||||
title: null,
|
||||
description: null,
|
||||
subscriberCount: 0,
|
||||
thumbnails: [],
|
||||
});
|
||||
|
||||
function reset() {
|
||||
for (let i in state) {
|
||||
state[i] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function set(obj) {
|
||||
for (let i in obj) {
|
||||
state[i] = obj[i];
|
||||
}
|
||||
}
|
||||
|
||||
return { state, set, reset };
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue