fix: Fixed auto login
This commit is contained in:
parent
973d6fc13f
commit
b310efe098
@ -21,7 +21,7 @@ const GridView = ({ settings, images }: GridViewProps) => {
|
||||
images
|
||||
.filter(i => !isVideo(i.url)) // TODO: filter out video for now, since we don't have a good way to display them
|
||||
.sort((a, b) => (b.timestamp && a.timestamp ? b.timestamp - a.timestamp : 0)), // sort by timestamp descending
|
||||
[images]
|
||||
[images, settings] // settings is not used here, but we need to include it to trigger a re-render when it changes
|
||||
);
|
||||
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
|
@ -183,7 +183,7 @@ const SlideShow = () => {
|
||||
// auto login when alby is available
|
||||
onLogin();
|
||||
}
|
||||
}, 500);
|
||||
}, 100);
|
||||
|
||||
document.body.addEventListener('keydown', onKeyDown);
|
||||
return () => {
|
||||
|
@ -7,11 +7,11 @@ declare global {
|
||||
}
|
||||
|
||||
const useAutoLogin = () => {
|
||||
const [autoLogin, setAutoLogin] = useState(false);
|
||||
const [autoLogin, setAutoLogin] = useState(JSON.parse(localStorage.getItem('autoLogin') as string) as boolean | undefined);
|
||||
|
||||
useEffect(() => {
|
||||
const disclaimerAcceptedPreviously = JSON.parse(localStorage.getItem('autoLogin') as string);
|
||||
if (disclaimerAcceptedPreviously === true) {
|
||||
const autoLogin = JSON.parse(localStorage.getItem('autoLogin') as string) as boolean | undefined;
|
||||
if (autoLogin === true) {
|
||||
setAutoLogin(true);
|
||||
}
|
||||
}, []);
|
||||
|
Loading…
Reference in New Issue
Block a user