software caching thumbnails in javascript
This commit is contained in:
parent
facefc1cc7
commit
e91b64ca97
5 changed files with 54 additions and 18 deletions
|
@ -29,8 +29,9 @@ const store = createStore({
|
|||
expiry: null,
|
||||
},
|
||||
|
||||
showAddBoxModal: false,
|
||||
thumbnailCache: {},
|
||||
persistent_loaded: false,
|
||||
showAddBoxModal: false,
|
||||
},
|
||||
getters: {
|
||||
route: state => router.currentRoute.value,
|
||||
|
@ -71,6 +72,12 @@ const store = createStore({
|
|||
isLoggedIn(state) {
|
||||
return state.user && state.user.username !== null && state.user.token !== null;
|
||||
},
|
||||
getThumbnail: (state) => (url) => {
|
||||
if (!url) return null;
|
||||
if (!(url in state.thumbnailCache))
|
||||
return null;
|
||||
return state.thumbnailCache[url];
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
updateLastEvent(state, slug) {
|
||||
|
@ -162,6 +169,9 @@ const store = createStore({
|
|||
user.permissions = null;
|
||||
state.user = user;
|
||||
},
|
||||
setThumbnail(state, {url, data}) {
|
||||
state.thumbnailCache[url] = data;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async login({commit}, {username, password, remember}) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue