Skip to content

Commit

Permalink
json.info fix, closes #165
Browse files Browse the repository at this point in the history
  • Loading branch information
Sozialarchiv committed May 17, 2021
1 parent a2b04d5 commit 4e5abe1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/viewer/image/ReactOpenSeadragon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function ReactOpenSeadragon(props: IProps) {

const {page, setPage, currentAnnotation, searchResult} = useContext(AppContext);
const viewer = useRef<Viewer | undefined | null>(undefined);
const id = useRef<number>(Math.random());
const id = useRef<number>(Math.floor(Math.random() * 10000));

const [spinner, setSpinner] = useState<boolean>(true);
const [showButtons, setShowButtons] = useState<boolean>(true);
Expand Down Expand Up @@ -125,13 +125,16 @@ export default function ReactOpenSeadragon(props: IProps) {

ImageApi.get(props.images[page].id).then(result => {

if (result[0] && result[0].statusCode === 401) {
if (
(result[0] && result[0].statusCode === 401) ||
!document.getElementById('openseadragon-' + id.current.toString(10))
) {
viewer.current = undefined;
return;
}

const options: Options = {
id: 'openseadragon-' + id.current,
id: 'openseadragon-' + id.current.toString(10),
defaultZoomLevel: 0,
tileSources: result,
showNavigationControl: true,
Expand Down

0 comments on commit 4e5abe1

Please sign in to comment.