fix: renew without params

This commit is contained in:
zerosoul
2022-03-22 17:13:40 +08:00
parent a23800b042
commit 4e56f15e24
6 changed files with 15 additions and 11 deletions
-1
View File
@@ -54,7 +54,6 @@ const baseQueryWithTokenCheck = async (args, api, extraOptions) => {
);
result = await waitingForRenew;
waitingForRenew = null;
// console.log({ refreshResult });
if (result.data) {
// store the new token
api.dispatch(updateToken(result.data));
+10 -3
View File
@@ -15,9 +15,13 @@ const userMsgSlice = createSlice({
state.byId = action.payload;
},
addUserMsg(state, action) {
const { id, mid } = action.payload;
const { id, mid, local_id } = action.payload;
if (state.byId[id]) {
if (state.byId[id].findIndex((id) => id == mid) > -1) return;
const midExsited = state.byId[id].findIndex((id) => id == mid) > -1;
const localMsgExsited =
state.byId[id].findIndex((id) => id == local_id) > -1;
if (midExsited || localMsgExsited) return;
state.byId[id].push(+mid);
} else {
state.byId[id] = [+mid];
@@ -28,7 +32,10 @@ const userMsgSlice = createSlice({
const { id, mid } = action.payload;
if (state.byId[id]) {
const idx = state.byId[id].findIndex((i) => i == mid);
state.byId[id].splice(idx, 1);
if (idx > -1) {
// 存在 则再删除
state.byId[id].splice(idx, 1);
}
}
},
},
@@ -39,7 +39,7 @@ export default function DeleteConfirmModal({ id, closeModal }) {
</Button>
</>
}
className="animate__animated animate__fadeInDown animate__faster"
// className="animate__animated animate__fadeInDown animate__faster"
></StyledModal>
</Modal>
);
@@ -25,7 +25,7 @@ export default function DeleteMessageConfirmModal({ closeModal, mid = 0 }) {
return (
<Modal>
<StyledModal
className="animate__animated animate__fadeInDown animate__faster"
// className="animate__animated animate__fadeInDown animate__faster"
buttons={
<>
<Button onClick={closeModal}>Cancel</Button>
@@ -63,7 +63,7 @@ export default function LogoutConfirmModal({ closeModal }) {
</Button>
</>
}
className="animate__animated animate__fadeInDown animate__faster"
// className="animate__animated animate__fadeInDown animate__faster"
>
<div className="clear">
<label htmlFor="clear_cb" className="txt">
+2 -4
View File
@@ -52,7 +52,7 @@ export default function useStreaming() {
const controller = new AbortController();
setStatus(StreamStatus.initializing);
const {
authData: { token, uid: loginUid },
authData: { token, refreshToken, uid: loginUid },
footprint: { afterMid, usersVersion },
} = store;
console.log("set uid use");
@@ -81,9 +81,7 @@ export default function useStreaming() {
) {
// 重新登录
if (response.status == 401) {
renewToken();
// dispatch(resetAuthData());
// return;
renewToken({ token, refreshToken });
}
// client-side errors are usually non-retriable:
throw new FatalError();