add and run prettier

This commit is contained in:
Lee
2023-10-17 23:38:18 +01:00
parent 47a23f0484
commit f6f56aa09c
136 changed files with 8231 additions and 4493 deletions

View File

@ -1,16 +1,20 @@
import createHttpStore from './http-store';
import playerApiClient from '../../network/clients/scoresaber/player/api'
import createHttpStore from "./http-store";
import playerApiClient from "../../network/clients/scoresaber/player/api";
export default (playerId = null, initialState = null, initialStateType = 'initial') => {
export default (
playerId = null,
initialState = null,
initialStateType = "initial",
) => {
let currentPlayerId = playerId;
const onNewData = ({fetchParams}) => {
const onNewData = ({ fetchParams }) => {
currentPlayerId = fetchParams?.playerId ?? null;
}
};
const httpStore = createHttpStore(
playerApiClient,
playerId ? {playerId} : null,
playerId ? { playerId } : null,
initialState,
{
onInitialized: onNewData,
@ -22,13 +26,12 @@ export default (playerId = null, initialState = null, initialStateType = 'initia
const fetch = async (playerId = currentPlayerId, force = false) => {
if (!playerId || (playerId === currentPlayerId && !force)) return false;
return httpStore.fetch({playerId}, force, playerApiClient);
}
return httpStore.fetch({ playerId }, force, playerApiClient);
};
return {
...httpStore,
fetch,
getPlayerId: () => currentPlayerId,
}
}
};
};