chore: first login modify password
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user