浏览代码

Sign out if token expired

pull/367/head
Guillaume Vincent 5 年前
父节点
当前提交
0a59ec9e19
共有 1 个文件被更改,包括 9 次插入9 次删除
  1. +9
    -9
      packages/mobile/src/password/PasswordGeneratorScreen.js

+ 9
- 9
packages/mobile/src/password/PasswordGeneratorScreen.js 查看文件

@@ -1,11 +1,6 @@
import React, { Component } from "react";
import { connect } from "react-redux";
import {
View,
ScrollView,
Clipboard,
TouchableWithoutFeedback
} from "react-native";
import { View, ScrollView, TouchableWithoutFeedback } from "react-native";
import { isEqual } from "lodash";
import { generatePassword } from "./passwordGenerator";
import TextInput from "../ui/TextInput";
@@ -16,6 +11,7 @@ import GeneratedPassword from "./GeneratedPassword";
import MasterPassword from "./MasterPassword";
import AutocompleteTextInput from "../ui/autocomplete/AutocompleteTextInput";
import { getPasswordProfiles } from "./profilesActions";
import { signOut } from "../auth/authActions";
import {
isProfileValid,
isLengthValid,
@@ -32,9 +28,12 @@ export class PasswordGeneratorScreen extends Component {
}

componentDidMount() {
const { auth, getPasswordProfiles } = this.props;
const { auth, getPasswordProfiles, signOut, navigation } = this.props;
if (auth.jwt) {
getPasswordProfiles();
getPasswordProfiles().catch(() => {
signOut();
navigation.navigate("Auth");
});
}
}

@@ -237,7 +236,8 @@ function mapStateToProps(state) {

function mapDispatchToProps(dispatch) {
return {
getPasswordProfiles: () => dispatch(getPasswordProfiles())
getPasswordProfiles: () => dispatch(getPasswordProfiles()),
signOut: () => dispatch(signOut())
};
}



正在加载...
取消
保存