Переглянути джерело

clean store

pull/342/head
Guillaume Vincent 8 роки тому
джерело
коміт
8011a0c1ee
3 змінених файлів з 6 додано та 9 видалено
  1. +1
    -4
      src/store.js
  2. +3
    -3
      src/views/Login.vue
  3. +2
    -2
      src/views/PasswordGenerator.vue

+ 1
- 4
src/store.js Переглянути файл

@@ -35,7 +35,6 @@ function getDefaultPasswordProfile(version, passwordProfile = {}) {
const versionLoadedByDefault = storage.json().version || 1;
const state = {
authenticated: auth.isAuthenticated(),
email: '',
passwordStatus: 'CLEAN',
passwords: [],
baseURL: 'https://lesspass.com',
@@ -47,9 +46,8 @@ export const mutations = {
LOGOUT(state){
state.authenticated = false;
},
USER_AUTHENTICATED(state, user){
LOGIN(state){
state.authenticated = true;
state.email = user.email;
},
SET_PASSWORDS(state, passwords){
state.passwords = passwords;
@@ -148,7 +146,6 @@ const getters = {
isAuthenticated: state => state.authenticated,
isGuest: state => !state.authenticated,
passwordStatus: state => state.passwordStatus,
email: state => state.email,
version: state => state.version,
};



+ 3
- 3
src/views/Login.vue Переглянути файл

@@ -171,8 +171,8 @@
this.auth.login({email, password}, baseURL)
.then(()=> {
this.loadingSignIn = false;
this.storage.save({baseURL, email});
this.$store.dispatch('USER_AUTHENTICATED', {email});
this.storage.save({baseURL});
this.$store.commit('LOGIN');
this.$router.push({name: 'home'});
})
.catch(err => {
@@ -259,7 +259,7 @@
return;
}

var passwordProfiles = {
const passwordProfiles = {
1: {
lowercase: true,
uppercase: true,


+ 2
- 2
src/views/PasswordGenerator.vue Переглянути файл

@@ -282,7 +282,7 @@
for (let i = 0; i < passwords.length; i++) {
const password = passwords[i];
if (password.site === site && password.login === login) {
this.$store.dispatch('PASSWORD_CHANGE', {password: {...password}});
this.$store.commit('SET_PASSWORD', {password});
this.$refs.masterPassword.focus();
break;
}
@@ -372,7 +372,7 @@
this.generatingPassword = false;
this.generatedPassword = generatedPassword;
window.document.getElementById('copyPasswordButton').setAttribute('data-clipboard-text', generatedPassword);
this.$store.dispatch('PASSWORD_GENERATED');
this.$store.commit('CHANGE_PASSWORD_STATUS', 'DIRTY');
});
},
setDefaultVersion(version){


Завантаження…
Відмінити
Зберегти