🎈 perf(尝试解决正式环境首次进入白屏问题):

This commit is contained in:
2022-12-06 14:33:39 +08:00
parent 3e7b70c190
commit ac56bfbd6d
3 changed files with 17 additions and 10 deletions
+4 -4
View File
@@ -155,7 +155,7 @@ export const useRequest = (
data: stateRef.current.query,
}
: {
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current.query) : stateRef.current.query,
data: options.type?.toUpperCase() == 'FORMDATA' ? qs.stringify(stateRef.current?.query) : stateRef.current.query,
}),
}
const result = await Taro.request(q as any)
@@ -181,14 +181,14 @@ export const useRequest = (
})
console.log('错误::', msg)
}
}
}
else {
if (statusCode === 401) {
removeToken()
removeSessionKey()
removeUserInfo()
login()
}
}
else {
Taro.showToast({
title: `错误:${showStatus(statusCode)}`,
@@ -196,7 +196,7 @@ export const useRequest = (
})
}
}
}
}
catch (e) {
stateRef.current.success = false
stateRef.current.error = true