const oauth = { state: { clientId: false, clientSecret: false, /* App token is authentication for app without any user, used mostly for * MastoAPI's registration of new users, stored so that we can fall back to * it on logout */ appToken: false, /* User token is authentication for app with user, this is for every calls * that need authorized user to be successful (i.e. posting, liking etc) */ userToken: false }, mutations: { setClientData (state, { clientId, clientSecret }) { state.clientId = clientId state.clientSecret = clientSecret }, setClientToken (state, token) { state.appToken = token }, setToken (state, token) { state.userToken = token } }, getters: { getToken: state => () => { return state.userToken || state.appToken } } } export default oauth