4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-14 13:16:37 +00:00
AzuraCast/frontend/vue/store.js
2022-12-09 21:45:41 -06:00

37 lines
871 B
JavaScript

import {defineStore} from "pinia";
export const usePlayerStore = defineStore(
'player',
{
state: () => {
return {
isPlaying: false,
current: {
url: null,
isStream: true
}
};
},
actions: {
toggle(payload) {
let url = payload.url;
if (this.current.url === url) {
this.current = {
url: null,
isStream: true
};
} else {
this.current = payload;
}
},
startPlaying() {
this.isPlaying = true;
},
stopPlaying() {
this.isPlaying = false;
}
}
}
);