From 3aad11336e3233d89936ba409ea07bb6ba8f2b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 10 Mar 2023 10:52:18 +0800 Subject: [PATCH] =?UTF-8?q?token=E8=BD=AC=E8=B4=A6=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=8A=B6=E6=80=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 2 +- src/forge/users/contribution/index.jsx | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index cf7fe8b6a..9ca6363a5 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || '' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/users/contribution/index.jsx b/src/forge/users/contribution/index.jsx index f79b047a9..1e8cd22ee 100644 --- a/src/forge/users/contribution/index.jsx +++ b/src/forge/users/contribution/index.jsx @@ -28,8 +28,15 @@ function Contribution(props){ const [error2, setError2] = useState(undefined); // 操作仓库id const [proId, setProId] = useState(undefined); - const {current_user:{user_id, login}} = props; + const {current_user:{user_id, login}, current_user} = props; const {user} = props; + const username = props.match.params.username; + + useEffect(()=>{ + if((username && current_user && (current_user.login !== username))){ + props.history.push(`/${username}`); + } + },[current_user,username]) useEffect(()=>{ // token转账列表