Added favorites button to actor page.

This commit is contained in:
DebaucheryLibrarian
2021-03-15 03:30:47 +01:00
parent e371e9725a
commit 77b40817f2
27 changed files with 466 additions and 169 deletions

View File

@@ -2,11 +2,16 @@ import { get, post, del } from '../api';
function initAuthActions(_store, _router) {
async function fetchMe({ commit }) {
const user = await get('/session');
try {
const user = await get('/session');
commit('setUser', user);
commit('setUser', user);
return user;
return user;
} catch (error) {
// continue as guest
return null;
}
}
async function login({ commit }, credentials) {

View File

@@ -1,11 +1,13 @@
import state from './state';
import mutations from './mutations';
import getters from './getters';
import actions from './actions';
function initAuthStore(store, router) {
return {
state,
mutations,
getters,
actions: actions(store, router),
};
}

View File

@@ -0,0 +1,8 @@
function favoritesStash(state) {
return state.user.stashes.find(stash => stash.slug === 'favorites');
}
module.exports = {
favoritesStash,
favorites: favoritesStash,
};