Skip to content

Commit 85ad1b0

Browse files
author
chenwenhao
committed
fix: [supervisor] fix logout auth bug
1 parent 61ff847 commit 85ad1b0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

solutions/supervisor/www/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const App = () => {
3333
);
3434
const [isNewVersionModalOpen, setIsNewVersionModalOpen] = useState(false);
3535
const [newVersion, setNewVersion] = useState("");
36-
const [isDisableLayout, setIsDisableLayout] = useState(true);
36+
const [isDisableLayout, setIsDisableLayout] = useState(false);
3737

3838
useEffect(() => {
3939
const param = parseUrlParam(window.location.href);

solutions/supervisor/www/src/utils/sensecraftRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const refreshToken = async () => {
7777

7878
if (!refresh_token || refresh_token == null || !token || token == null) {
7979
// 需要登录
80-
sensecraftAuthorize();
80+
// sensecraftAuthorize();
8181
return Promise.reject();
8282
}
8383
try {

solutions/supervisor/www/src/views/workspace/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ const Workspace = () => {
202202
// 自动保存
203203
useEffect(() => {
204204
const intervalId = setInterval(() => {
205-
if (!loading && !syncing) {
205+
if (!loading && !syncing && token) {
206206
autoSaveApp();
207207
}
208208
}, 15000);
209209
return () => clearInterval(intervalId);
210-
}, [loading, syncing]);
210+
}, [loading, syncing, token]);
211211

212212
// 切换路由的时候做一次自动保存
213213
useEffect(() => {
@@ -225,7 +225,7 @@ const Workspace = () => {
225225

226226
useEffect(() => {
227227
const initAction = async () => {
228-
if (actionInfo?.action) {
228+
if (actionInfo?.action && token) {
229229
const action = actionInfo.action; //new / app / clone / model /normal action为空默认为normal
230230
const app_id = actionInfo.app_id; //type为app时才需要传
231231
const model_id = actionInfo.model_id; //type为model时才需要传
@@ -256,7 +256,7 @@ const Workspace = () => {
256256
}
257257
};
258258
initAction();
259-
}, [actionInfo?.action]);
259+
}, [actionInfo?.action, token]);
260260

261261
const getSensecraftUserInfo = async () => {
262262
try {

0 commit comments

Comments
 (0)