chore: first login modify password

This commit is contained in:
jialin
2024-06-29 20:29:11 +08:00
parent cf0113e8d8
commit d47e53114c
25 changed files with 337 additions and 113 deletions
+2
View File
@@ -162,6 +162,7 @@ const useSetChunkRequest = () => {
let result = response;
let cres = '';
console.log('chunkrequest============e==', e);
if (contentType === 'json') {
const currentRes = sliceData(response, e.loaded, loadedSize);
result = parseData(currentRes);
@@ -183,6 +184,7 @@ const useSetChunkRequest = () => {
retryCount.current -= 1;
}
} catch (error) {
console.log('error=============', error);
if (!axios.isCancel(error)) {
setRequestReadyState(4);
if (retryCount.current > 0) {
+12 -1
View File
@@ -1,5 +1,5 @@
import qs from 'query-string';
import { useRef } from 'react';
import { useEffect, useRef } from 'react';
export const createEventSourceURL = (url: string) => {
const { host, protocol } = window.location;
@@ -42,9 +42,14 @@ export default function useEventSource() {
onmessage(data);
} catch (error) {
// error
console.log('event source error: ', error);
}
};
eventSourceRef.current.onclose = () => {
console.log('event source closed...');
};
eventSourceRef.current.onopen = () => {
console.log('event source connected...');
};
@@ -54,6 +59,12 @@ export default function useEventSource() {
};
};
useEffect(() => {
return () => {
eventSourceRef.current?.close?.();
};
}, []);
return {
eventSourceRef: eventSourceRef,
createEventSourceConnection