fix getSimpleArtistCoverUrl

This commit is contained in:
Petitminion 2025-05-20 17:33:38 +02:00 committed by Arne Bollinger
parent 79e934d73e
commit 8b7db259ac
2 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { Library } from '~/types'
import { ref, reactive, onMounted, computed, watch } from 'vue'
import { ref, reactive, onMounted, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import axios from 'axios'

View File

@ -50,5 +50,15 @@ const getSimpleArtistCover = (artist: components['schemas']['SimpleChannelArtist
* @param artist: a simple artist
* @param field: the size you want
*/
export const getSimpleArtistCoverUrl = (artist: components['schemas']['SimpleChannelArtist'] | components['schemas']['Artist'] | components['schemas']['ArtistWithAlbums'], field: 'original' | 'small_square_crop' | 'medium_square_crop' | 'large_square_crop') =>
store.getters['instance/absoluteUrl'](getSimpleArtistCover(artist)(field))
export const getSimpleArtistCoverUrl = (
artist: components['schemas']['SimpleChannelArtist'] | components['schemas']['Artist'] | components['schemas']['ArtistWithAlbums'],
field: 'original' | 'small_square_crop' | 'medium_square_crop' | 'large_square_crop'
): string | null => {
const coverGetter = getSimpleArtistCover(artist);
if (!coverGetter) return null;
const cover = coverGetter(field);
if (!cover) return null;
return store.getters['instance/absoluteUrl'](cover);
};