admin-fe/src/services/pleromaAuth.js
2019-09-13 20:50:21 +00:00

15 lines
425 B
JavaScript

import localforage from 'localforage'
import _ from 'lodash'
const pleromaFEStateKey = 'vuex-lz'
export const authenticateWithPleromaFE = async(store) => {
const pleromaFEState = await localforage.getItem(pleromaFEStateKey)
const token = _.get(pleromaFEState, 'oauth.userToken')
if (token === undefined) {
throw new Error('PleromaFE token not found')
}
await store.dispatch('LoginByPleromaFE', { token })
}