|
@@ -56,8 +56,9 @@ export class AuthGuard implements CanActivate {
|
|
if (!Parse.User.current()?.id) {
|
|
if (!Parse.User.current()?.id) {
|
|
Parse.Cloud.run('reviewToken')
|
|
Parse.Cloud.run('reviewToken')
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
+ console.log(res);
|
|
Parse.User.become(
|
|
Parse.User.become(
|
|
- res?.token || 'r:4d692312d4b08d4120981152e67428f8'
|
|
|
|
|
|
+ res?.token || 'r:3494b9dca7a5de2b8394e48e2e51c490'
|
|
)
|
|
)
|
|
.then((user) => resolve(true))
|
|
.then((user) => resolve(true))
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -72,30 +73,6 @@ export class AuthGuard implements CanActivate {
|
|
resolve(false);
|
|
resolve(false);
|
|
this.router.navigate([this.LoginPage]);
|
|
this.router.navigate([this.LoginPage]);
|
|
});
|
|
});
|
|
- // fetch('https://145.tbook.com.cn/api/textbook/review/token', {
|
|
|
|
- // method: 'POST',
|
|
|
|
- // headers: {
|
|
|
|
- // 'Content-Type': 'application/json',
|
|
|
|
- // },
|
|
|
|
- // })
|
|
|
|
- // .then((response) => response.json())
|
|
|
|
- // .then(async (res) => {
|
|
|
|
- // Parse.User.become(
|
|
|
|
- // res?.token || 'r:4d692312d4b08d4120981152e67428f8'
|
|
|
|
- // )
|
|
|
|
- // .then((user) => resolve(true))
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // console.log(err);
|
|
|
|
- // window.location.href =
|
|
|
|
- // 'https://audit.hep.com.cn/admin/401?noGoBack=0';
|
|
|
|
- // resolve(false);
|
|
|
|
- // });
|
|
|
|
- // })
|
|
|
|
- // .catch((error) => {
|
|
|
|
- // console.error('获取token失败:', error);
|
|
|
|
- // resolve(false);
|
|
|
|
- // this.router.navigate([this.LoginPage]);
|
|
|
|
- // });
|
|
|
|
} else {
|
|
} else {
|
|
resolve(true);
|
|
resolve(true);
|
|
}
|
|
}
|