forked from DebaucheryLibrarian/traxxx
Added favorites button to actor page.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
8
assets/js/auth/getters.js
Normal file
8
assets/js/auth/getters.js
Normal file
@@ -0,0 +1,8 @@
|
||||
function favoritesStash(state) {
|
||||
return state.user.stashes.find(stash => stash.slug === 'favorites');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
favoritesStash,
|
||||
favorites: favoritesStash,
|
||||
};
|
||||
Reference in New Issue
Block a user