chore: run prettier format

This commit is contained in:
Julian Tölle 2021-05-25 16:01:55 +02:00
parent b6c7c9e16d
commit f56548e432
12 changed files with 95 additions and 95 deletions

View file

@ -13,7 +13,7 @@ interface ApiClientContext {
}
const apiClientContext = createContext<ApiClientContext>(
(undefined as any) as ApiClientContext
undefined as any as ApiClientContext
);
export const ProvideApiClient: React.FC = ({ children }) => {

View file

@ -20,16 +20,18 @@ Object.freeze(INITIAL_EMPTY_ARRAY);
export const useRecentListens = (options: PaginationOptions) => {
const { client } = useApiClient();
const fetchData = useMemo(() => () => getRecentListens(options, client), [
options,
client,
]);
const { value, pending: isLoading, error, reload } = useAsync(
fetchData,
undefined
const fetchData = useMemo(
() => () => getRecentListens(options, client),
[options, client]
);
const {
value,
pending: isLoading,
error,
reload,
} = useAsync(fetchData, undefined);
const recentListens = value ? value.items : [];
const paginationMeta = value ? value.meta : undefined;
@ -39,63 +41,67 @@ export const useRecentListens = (options: PaginationOptions) => {
export const useListensReport = (options: ListenReportOptions) => {
const { client } = useApiClient();
const fetchData = useMemo(() => () => getListensReport(options, client), [
options,
client,
]);
const { value: report, pending: isLoading, error } = useAsync(
fetchData,
INITIAL_EMPTY_ARRAY
const fetchData = useMemo(
() => () => getListensReport(options, client),
[options, client]
);
const {
value: report,
pending: isLoading,
error,
} = useAsync(fetchData, INITIAL_EMPTY_ARRAY);
return { report, isLoading, error };
};
export const useTopArtists = (options: TopArtistsOptions) => {
const { client } = useApiClient();
const fetchData = useMemo(() => () => getTopArtists(options, client), [
options,
client,
]);
const { value: topArtists, pending: isLoading, error } = useAsync(
fetchData,
INITIAL_EMPTY_ARRAY
const fetchData = useMemo(
() => () => getTopArtists(options, client),
[options, client]
);
const {
value: topArtists,
pending: isLoading,
error,
} = useAsync(fetchData, INITIAL_EMPTY_ARRAY);
return { topArtists, isLoading, error };
};
export const useTopAlbums = (options: TopAlbumsOptions) => {
const { client } = useApiClient();
const fetchData = useMemo(() => () => getTopAlbums(options, client), [
options,
client,
]);
const { value: topAlbums, pending: isLoading, error } = useAsync(
fetchData,
INITIAL_EMPTY_ARRAY
const fetchData = useMemo(
() => () => getTopAlbums(options, client),
[options, client]
);
const {
value: topAlbums,
pending: isLoading,
error,
} = useAsync(fetchData, INITIAL_EMPTY_ARRAY);
return { topAlbums, isLoading, error };
};
export const useTopTracks = (options: TopTracksOptions) => {
const { client } = useApiClient();
const fetchData = useMemo(() => () => getTopTracks(options, client), [
options,
client,
]);
const { value: topTracks, pending: isLoading, error } = useAsync(
fetchData,
INITIAL_EMPTY_ARRAY
const fetchData = useMemo(
() => () => getTopTracks(options, client),
[options, client]
);
const {
value: topTracks,
pending: isLoading,
error,
} = useAsync(fetchData, INITIAL_EMPTY_ARRAY);
return { topTracks, isLoading, error };
};

View file

@ -17,9 +17,7 @@ interface AuthContext {
loginWithSpotifyProps: () => { href: string };
}
const authContext = createContext<AuthContext>(
(undefined as any) as AuthContext
);
const authContext = createContext<AuthContext>(undefined as any as AuthContext);
export const ProvideAuth: React.FC = ({ children }) => {
const auth = useProvideAuth();