Fix composables calling `useI18n` too early
This commit is contained in:
parent
db426863d4
commit
a0c9fdee78
|
@ -49,12 +49,12 @@ export default (props: PlayOptionsProps) => {
|
||||||
const filterableArtist = computed(() => props.track?.artist ?? props.album?.artist ?? props.artist)
|
const filterableArtist = computed(() => props.track?.artist ?? props.album?.artist ?? props.artist)
|
||||||
const filterArtist = async () => store.dispatch('moderation/hide', { type: 'artist', target: filterableArtist.value })
|
const filterArtist = async () => store.dispatch('moderation/hide', { type: 'artist', target: filterableArtist.value })
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const addMessage = (tracks: Track[]) => {
|
const addMessage = (tracks: Track[]) => {
|
||||||
if (!tracks.length) {
|
if (!tracks.length) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
store.commit('ui/addMessage', {
|
store.commit('ui/addMessage', {
|
||||||
content: t('composables.audio.usePlayOptions.addToQueueMessage', tracks.length),
|
content: t('composables.audio.usePlayOptions.addToQueueMessage', tracks.length),
|
||||||
date: new Date()
|
date: new Date()
|
||||||
|
|
|
@ -20,9 +20,12 @@ export type EditObject = (Partial<Artist> | Partial<Album> | Partial<Track>) & {
|
||||||
export type EditObjectType = 'artist' | 'album' | 'track'
|
export type EditObjectType = 'artist' | 'album' | 'track'
|
||||||
type Configs = Record<EditObjectType, { fields: (EditableConfigField|ConfigField)[] }>
|
type Configs = Record<EditObjectType, { fields: (EditableConfigField|ConfigField)[] }>
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
const getContentValueRepr = (val: Content) => val.text
|
const getContentValueRepr = (val: Content) => val.text
|
||||||
|
|
||||||
|
// TODO: Get params from typescript type somehow?
|
||||||
|
export default (): Configs => {
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
const description: ConfigField = {
|
const description: ConfigField = {
|
||||||
id: 'description',
|
id: 'description',
|
||||||
type: 'content',
|
type: 'content',
|
||||||
|
@ -49,8 +52,7 @@ const tags: ConfigField = {
|
||||||
getValueRepr: (tags: string[]) => tags.slice().sort().join('\n')
|
getValueRepr: (tags: string[]) => tags.slice().sort().join('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Get params from typescript type somehow?
|
return {
|
||||||
export default (): Configs => ({
|
|
||||||
artist: {
|
artist: {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
@ -122,4 +124,5 @@ export default (): Configs => ({
|
||||||
tags
|
tags
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ export interface Entity {
|
||||||
|
|
||||||
type Configs = Record<EntityObjectType, Entity>
|
type Configs = Record<EntityObjectType, Entity>
|
||||||
|
|
||||||
|
export default (): Configs => {
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const tags: ModeratedField = {
|
const tags: ModeratedField = {
|
||||||
|
@ -50,7 +51,7 @@ const visibility: ModeratedField = {
|
||||||
label: t('composables.moderation.useReportConfigs.visibility.label')
|
label: t('composables.moderation.useReportConfigs.visibility.label')
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (): Configs => ({
|
return {
|
||||||
artist: {
|
artist: {
|
||||||
label: t('composables.moderation.useReportConfigs.artist.label'),
|
label: t('composables.moderation.useReportConfigs.artist.label'),
|
||||||
icon: 'users',
|
icon: 'users',
|
||||||
|
@ -181,4 +182,5 @@ export default (): Configs => ({
|
||||||
tags
|
tags
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue