You've already forked AstralRinth
forked from didirus/AstralRinth
* Order notifications and followed mods Fixes modrinth/knossos#195 * Add user notification badge on avatar Closes modrinth/knossos#145 * Add loading animation * Chain calls, remove console.log * Chain calls * Fix formatting to match prettier * Remove unused userFollows * Create user vuex store * Add notification count indication on dashboard * Fix background for light mode * Move delay check to action, add force parameter * Slightly decrease notification badge opacity on dashboard * Remove SVG for image masking, use border around bubble Also adds CSS for when the dropdown is opened/hovered * Fix merge conflicts Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
42 lines
812 B
JavaScript
42 lines
812 B
JavaScript
export const state = () => ({
|
|
user: null,
|
|
token: '',
|
|
headers: {},
|
|
})
|
|
|
|
export const mutations = {
|
|
SET_USER(state, user) {
|
|
state.user = user
|
|
},
|
|
SET_TOKEN(state, token) {
|
|
state.token = token
|
|
},
|
|
SET_HEADERS(state, headers) {
|
|
state.headers = headers
|
|
},
|
|
}
|
|
|
|
export const actions = {
|
|
async fetchUser({ commit }, { token }) {
|
|
try {
|
|
const user = (
|
|
await this.$axios.get(`https://api.modrinth.com/api/v1/user`, {
|
|
headers: {
|
|
Authorization: token,
|
|
},
|
|
})
|
|
).data
|
|
|
|
commit('SET_USER', user)
|
|
commit('SET_TOKEN', token)
|
|
commit('SET_HEADERS', {
|
|
headers: {
|
|
Authorization: token,
|
|
},
|
|
})
|
|
} catch (e) {
|
|
console.error('Request for user info encountered an error: ', e)
|
|
}
|
|
},
|
|
}
|