fix getSimpleArtistCoverUrl
This commit is contained in:
parent
79e934d73e
commit
8b7db259ac
|
@ -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'
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue