feat: use blurHash when loading list backgrounds #1188
|
@ -20,7 +20,7 @@ export default class ListModel extends AbstractModel {
|
|||
|
||||
this.owner = new UserModel(this.owner)
|
||||
|
||||
if(typeof this.subscription !== 'undefined' && this.subscription !== null) {
|
||||
if (typeof this.subscription !== 'undefined' && this.subscription !== null) {
|
||||
this.subscription = new SubscriptionModel(this.subscription)
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ export default class ListModel extends AbstractModel {
|
|||
isFavorite: false,
|
||||
subscription: null,
|
||||
position: 0,
|
||||
backgroundBlurHash: '',
|
||||
|
||||
created: null,
|
||||
updated: null,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {createStore} from 'vuex'
|
||||
import {getBlobFromBlurHash} from '../helpers/getBlobFromBlurHash'
|
||||
import {
|
||||
BACKGROUND,
|
||||
CURRENT_LIST,
|
||||
|
@ -128,10 +129,15 @@ export const store = createStore({
|
|||
) {
|
||||
if (currentList.backgroundInformation) {
|
||||
try {
|
||||
const blurHash = await getBlobFromBlurHash(currentList.backgroundBlurHash)
|
||||
if(blurHash) {
|
||||
commit(BACKGROUND, window.URL.createObjectURL(blurHash))
|
||||
}
|
||||
|
||||
const listService = new ListService()
|
||||
const background = await listService.background(currentList)
|
||||
commit(BACKGROUND, background)
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error('Error getting background image for list', currentList.id, e)
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user