mirror of
https://github.com/PhaseII-eAmusement-Network/PhaseWeb3-Vue.git
synced 2026-07-20 09:43:16 -05:00
Add Jubility to table, fix Network bug with Error Codes
This commit is contained in:
parent
bf8fb99ae5
commit
24a3499b33
|
|
@ -85,6 +85,7 @@ onMounted(async () => {
|
|||
<h2 class="text-md">{{ song.songData.artist }}</h2>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-lg">Jubility: {{ song.value / 10 }}</h2>
|
||||
<h2 class="text-lg">Rate: {{ song.rate / 10 }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -74,10 +74,11 @@ export const useMainStore = defineStore("main", {
|
|||
});
|
||||
},
|
||||
|
||||
async callApi(endpoint, method = "GET", data = null) {
|
||||
async callApi(endpoint, method = "GET", data = null, extraHeaders = {}) {
|
||||
const apiServer = import.meta.env.VITE_API_URL;
|
||||
const apiKey = import.meta.env.VITE_API_KEY;
|
||||
let loadingTimeout;
|
||||
this.errorCode = ""; // We want to reset the network error.
|
||||
|
||||
const startLoading = () => {
|
||||
loadingTimeout = setTimeout(() => {
|
||||
|
|
@ -90,11 +91,13 @@ export const useMainStore = defineStore("main", {
|
|||
// Start loading after the specified delay
|
||||
startLoading();
|
||||
|
||||
const headers = {
|
||||
const baseHeaders = {
|
||||
"App-Auth-Key": apiKey,
|
||||
"User-Auth-Key": loadUserAuthKey(),
|
||||
};
|
||||
|
||||
const headers = { ...baseHeaders, ...extraHeaders };
|
||||
|
||||
const url = `${apiServer}/v1${endpoint}`;
|
||||
|
||||
const config = {
|
||||
|
|
@ -302,8 +305,11 @@ export const useMainStore = defineStore("main", {
|
|||
async getMusicData(game, version, songIds = null, oneChart = false) {
|
||||
try {
|
||||
const data = await this.callApi(
|
||||
`/music?game=${game}&version=${version}&songIds=${songIds.toString()}` +
|
||||
(oneChart ? "&oneChart=true" : "")
|
||||
`/music?game=${game}&version=${version}` +
|
||||
(oneChart ? "&oneChart=true" : ""),
|
||||
"GET",
|
||||
null,
|
||||
{ songIds: songIds.toString() }
|
||||
);
|
||||
return data.data;
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user