Commit 0a4e8c54 by zhanghaozhe

微信登录拿完code后去掉无用query

parent 78d5d001
import React, {Component} from 'react' import React, { Component } from 'react'
import Routes from './router' import Routes from './router'
import cookie from 'js-cookie' import cookie from 'js-cookie'
import {connect} from "react-redux" import { connect } from "react-redux"
import {setCurrentUser, startFetchUser} from "@/store/userAction" import { setCurrentUser, startFetchUser } from "@/store/userAction"
import {initialState} from "@/store/userReducer" import { initialState } from "@/store/userReducer"
import {withRouter, Link} from 'react-router-dom' import { withRouter, Link } from 'react-router-dom'
import {compose} from 'redux' import { compose } from 'redux'
import {getParam, http, browser} from "@/utils" import { getParam, http, browser } from "@/utils"
import {Toast} from "antd-mobile" import { Toast } from "antd-mobile"
import {addDays} from 'date-fns' import { addDays } from 'date-fns'
import stringify from 'json-stringify-safe' import stringify from 'json-stringify-safe'
import Hammer from 'hammerjs' import Hammer from 'hammerjs'
...@@ -203,7 +203,15 @@ class App extends Component { ...@@ -203,7 +203,15 @@ class App extends Component {
cookie.set('role', role, {expires, domain: '.julyedu.com', path: '/'}) cookie.set('role', role, {expires, domain: '.julyedu.com', path: '/'})
cookie.set('uid', uid, {expires, domain: '.julyedu.com', path: '/'}) cookie.set('uid', uid, {expires, domain: '.julyedu.com', path: '/'})
cookie.set('token', token, {expires, domain: '.julyedu.com', path: '/'}) cookie.set('token', token, {expires, domain: '.julyedu.com', path: '/'})
this.props.setCurrentUser(user)
const search = new URLSearchParams(window.location.search)
search.delete('code')
search.delete('aa')
if (search.has('state') && search.get('state') === 'STATE') {
search.delete('state')
}
const loc = window.location
loc.replace(loc.origin + loc.pathname + '?' + search.toString() + loc.hash)
} }
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment