Switched to Pinia, Added Save for Albums

This commit is contained in:
Shiny Nematoda 2022-07-17 08:06:17 +00:00
parent a43b0907e2
commit f303f91108
No known key found for this signature in database
GPG key ID: 6506D50F5613A42D
25 changed files with 945 additions and 799 deletions

44
src/stores/results.js Normal file
View 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 };
});