typescript 我想从url中获取group_id,我正在使用angular 5,我无法获取group_id,我已经共享了示例链接和代码

bprjcwpo  于 2023-04-13  发布在  TypeScript
关注(0)|答案(1)|浏览(105)
const ssoToken = this.route.snapshot.queryParams['token'];
const urlId = this.route.snapshot.params['id'];

if (ssoToken) {
  value = ssoToken;
  console.log(value,"this is value")
  
} else if(urlId){
  value = urlId;
}else {
  value = window.location.origin;
}
if (value != urlId) {
  try {
    if (ssoToken) {
      this.resAuth = jwt_decode(value);
    } else {
      this.resAuth = value;
    }

我已经尝试了这个.route.snapshot.queryParams但没有得到它,这里是链接=〉localhost:4200/login?token= eyJhbGciOiJIUzI 1 NiJ 9. eyJjb 21 tdW 5 pdHlfaWQiOiJmMTMyOWM 5 MC 01 ZTg 1 LTExZWMtOTg 1 Ny 02 OWMxNjdlYjIwOTIiLCJiYXRjaF 9 pZCI 6 ImVjZDdhODAwLTk 5 ZmItMTFlYY 1 iZW M1LTM 3 ODNjYmJjYThkOCJ 9. 7 jtm 5xaMXUYrAuB 5v 0 H6 ipso 5 olzyPsnu-OwluXm 0 k8 group_id= 0 rpe 0

vwkv1x7d

vwkv1x7d1#

更新您的链接并在令牌后放置(&)...&group_id=0rpe0
并获得

const urlId = this.route.snapshot.params['group_id'];

相关问题