♻️ refactor: 重写token截取规则

This commit is contained in:
wangsongsole 2023-05-08 09:55:11 +08:00
parent 7a0fa5b76d
commit 570427fb2f
1 changed files with 4 additions and 1 deletions

View File

@ -17,7 +17,10 @@ export default class App extends Component {
componentWillMount() { componentWillMount() {
const tokenString = this.props.location.search; const tokenString = this.props.location.search;
const token = tokenString.substring(tokenString.indexOf('=') + 1); const token = tokenString.substring(
tokenString.indexOf('=') + 1,
tokenString.indexOf('&')
);
/* 判断是否有token */ /* 判断是否有token */
if (tokenString && tokenString.indexOf('=') > -1) { if (tokenString && tokenString.indexOf('=') > -1) {
this.onSubmit(token); this.onSubmit(token);