aboutsummaryrefslogtreecommitdiff
path: root/src/site/store
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-05 04:18:08 +0300
committerZephyrrus <[email protected]>2020-07-05 04:18:08 +0300
commit766e74cc51138b32482f65f0f2647eb9d943103e (patch)
treed675cdaa4dc4a89356009131707b11b511069494 /src/site/store
parentfeat: refactor single album page to use vuex (diff)
downloadhost.fuwn.me-766e74cc51138b32482f65f0f2647eb9d943103e.tar.xz
host.fuwn.me-766e74cc51138b32482f65f0f2647eb9d943103e.zip
feat: add video preview on hover to dashboard and apply new linter rules to some of the files
Diffstat (limited to 'src/site/store')
-rw-r--r--src/site/store/auth.js20
-rw-r--r--src/site/store/images.js4
2 files changed, 12 insertions, 12 deletions
diff --git a/src/site/store/auth.js b/src/site/store/auth.js
index 73976d6..55009ce 100644
--- a/src/site/store/auth.js
+++ b/src/site/store/auth.js
@@ -4,14 +4,14 @@ const getDefaultState = () => ({
loggedIn: false,
isLoading: false,
user: null,
- token: null
+ token: null,
});
export const state = getDefaultState;
export const getters = {
- isLoggedIn: state => state.loggedIn,
- getApiKey: state => state.user?.apiKey
+ isLoggedIn: (state) => state.loggedIn,
+ getApiKey: (state) => state.user?.apiKey,
};
export const actions = {
@@ -27,7 +27,7 @@ export const actions = {
commit('loginRequest');
try {
- const data = await this.$axios.$post(`auth/login`, { username, password });
+ const data = await this.$axios.$post('auth/login', { username, password });
this.$axios.setToken(data.token, 'Bearer');
commit('setToken', data.token);
@@ -38,7 +38,7 @@ export const actions = {
},
async fetchCurrentUser({ commit, dispatch }) {
try {
- const data = await this.$axios.$get(`users/me`);
+ const data = await this.$axios.$get('users/me');
commit('setUser', data.user);
} catch (e) {
dispatch('alert/set', { text: e.message, error: true }, { root: true });
@@ -46,9 +46,9 @@ export const actions = {
},
async changePassword({ dispatch }, { password, newPassword }) {
try {
- const response = await this.$axios.$post(`user/password/change`, {
+ const response = await this.$axios.$post('user/password/change', {
password,
- newPassword
+ newPassword,
});
return response;
@@ -58,7 +58,7 @@ export const actions = {
},
async requestAPIKey({ commit, dispatch }) {
try {
- const response = await this.$axios.$post(`user/apikey/change`);
+ const response = await this.$axios.$post('user/apikey/change');
commit('setApiKey', response.apiKey);
return response;
@@ -68,7 +68,7 @@ export const actions = {
},
logout({ commit }) {
commit('logout');
- }
+ },
};
export const mutations = {
@@ -94,5 +94,5 @@ export const mutations = {
this.$cookies.remove('token');
// reset state to default
Object.assign(state, getDefaultState());
- }
+ },
};
diff --git a/src/site/store/images.js b/src/site/store/images.js
index f6dae1b..14f475a 100644
--- a/src/site/store/images.js
+++ b/src/site/store/images.js
@@ -25,7 +25,7 @@ export const actions = {
try {
const response = await this.$axios.$get(`files`, { params: { limit: state.pagination.limit, page } });
- commit('updateFiles', { files: response.files });
+ commit('setFiles', { files: response.files });
commit('updatePaginationMeta', { totalFiles: response.count, page });
} catch (e) {
dispatch('alert/set', { text: e.message, error: true }, { root: true });
@@ -45,7 +45,7 @@ export const mutations = {
setIsLoading(state) {
state.isLoading = true;
},
- updateFiles(state, { files }) {
+ setFiles(state, { files }) {
state.files = files || [];
state.isLoading = false;
},