OhMyDitzzy commited on
Commit ·
b438982
1
Parent(s): 2049481
Anything
Browse files
src/modules/comic/ComicReader.tsx
CHANGED
|
@@ -36,26 +36,33 @@ export function ComicReader() {
|
|
| 36 |
const [showPageJump, setShowPageJump] = useState(false);
|
| 37 |
const [jumpPage, setJumpPage] = useState('');
|
| 38 |
const [loadingChapter, setLoadingChapter] = useState(false);
|
| 39 |
-
const [password,
|
| 40 |
-
const [originalSessionId,
|
| 41 |
|
| 42 |
const imageRefs = useRef<{ [key: number]: HTMLImageElement | null }>({});
|
| 43 |
const controlsTimeout = useRef<number | null>(null);
|
| 44 |
const scrollContainerRef = useRef<HTMLDivElement | null>(null);
|
| 45 |
const wsRef = useRef<WebSocket | null>(null);
|
| 46 |
const chapterData = location.state?.chapterData;
|
|
|
|
| 47 |
const statePassword = location.state?.password;
|
| 48 |
const stateSessionId = location.state?.sessionId;
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
useEffect(() => {
|
| 61 |
if (!password || !originalSessionId) return;
|
|
|
|
| 36 |
const [showPageJump, setShowPageJump] = useState(false);
|
| 37 |
const [jumpPage, setJumpPage] = useState('');
|
| 38 |
const [loadingChapter, setLoadingChapter] = useState(false);
|
| 39 |
+
const [password, setPassword] = useState<string>('');
|
| 40 |
+
const [originalSessionId, setOriginalSessionId] = useState<string>('');
|
| 41 |
|
| 42 |
const imageRefs = useRef<{ [key: number]: HTMLImageElement | null }>({});
|
| 43 |
const controlsTimeout = useRef<number | null>(null);
|
| 44 |
const scrollContainerRef = useRef<HTMLDivElement | null>(null);
|
| 45 |
const wsRef = useRef<WebSocket | null>(null);
|
| 46 |
const chapterData = location.state?.chapterData;
|
| 47 |
+
useEffect(() => {
|
| 48 |
const statePassword = location.state?.password;
|
| 49 |
const stateSessionId = location.state?.sessionId;
|
| 50 |
+
|
| 51 |
+
console.log('[Reader] Initializing auth data:', {
|
| 52 |
+
hasPassword: !!statePassword,
|
| 53 |
+
hasSessionId: !!stateSessionId,
|
| 54 |
+
password: statePassword,
|
| 55 |
+
sessionId: stateSessionId
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
if (statePassword) {
|
| 59 |
+
setPassword(statePassword);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
if (stateSessionId) {
|
| 63 |
+
setOriginalSessionId(stateSessionId);
|
| 64 |
+
}
|
| 65 |
+
}, [location.state]);
|
| 66 |
|
| 67 |
useEffect(() => {
|
| 68 |
if (!password || !originalSessionId) return;
|