Skip to content

Commit cf64fc7

Browse files
authored
Merge pull request #74 from billilge/fix/#73-pwa-start-url
[Fix/#73] PWA 첫 진입 시 비로그인 상태에서 메인 화면이 잠시 보이던 현상 수정
2 parents f8e3aef + b91b8a2 commit cf64fc7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"background_color": "#f3f4f6",
44
"display": "standalone",
55
"scope": ".",
6-
"start_url": "/mobile/main",
6+
"start_url": "/mobile/sign-in",
77
"name": "빌릴게",
88
"short_name": "빌릴게",
99
"description": "국민대학교 소프트웨어융합대학 복지물품 대여 서비스",

src/app/mobile/sign-in/page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22

33
import ImageLoginLogo from 'public/assets/images/image-login-logo.svg';
44
import IconGoogle from 'public/assets/icons/icon-google.svg';
5+
import { useEffect } from 'react';
6+
import { useRouter } from 'next/navigation';
57

68
export default function SignIn() {
9+
const router = useRouter();
10+
711
const handleLogin = () => {
812
window.location.href = `${process.env.NEXT_PUBLIC_API_BASE_URI}/oauth2/authorization/google`;
913
};
1014

15+
useEffect(() => {
16+
if (localStorage.getItem('token')) {
17+
router.replace('/mobile/main');
18+
}
19+
}, []);
20+
1121
return (
1222
<section className="relative flex h-dvh w-full flex-col items-center justify-start overflow-hidden">
1323
<section className="mt-[128px] flex flex-col items-center justify-start gap-1.5">
@@ -18,7 +28,7 @@ export default function SignIn() {
1828
</section>
1929
<ImageLoginLogo className="absolute top-24" />
2030
<button
21-
className="absolute bottom-44 flex w-11/12 justify-between rounded-2xl border bg-white-primary px-6 py-4"
31+
className="absolute bottom-44 flex w-11/12 max-w-md justify-between rounded-2xl border bg-white-primary px-6 py-4"
2232
type="button"
2333
onClick={handleLogin}
2434
>

0 commit comments

Comments
 (0)