[fix] solution/frontend: 로그인·가입 직후엔 내 사이트로 — '/' 는 이제 랜딩이다
'/' 를 로그인 여부와 무관하게 랜딩으로 바꾸면서, 로그인 기본 도착지가 '/' 인 채로 남아 방금 로그인한 사장님이 판매 화면을 보게 됐다. - LoginPage: 기본 도착지를 selfServe 면 /sites. 내부 운영 앱은 '/' 가 자기 홈으로 가므로 그대로 - SignupPage: 가입 직후도 /sites
This commit is contained in:
parent
cc4c23b325
commit
7660c3b574
@ -27,9 +27,11 @@ export function LoginPage({selfServe = true}: {selfServe?: boolean}) {
|
||||
const [password, setPassword] = useState('1234');
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
// ★ 기본 도착지를 '/' 로 둔다. 앱마다 홈이 다르고(사장님 → 빌더, 내부 → 사업장 목록)
|
||||
// 각 라우터의 '/' 리다이렉트가 이미 그걸 안다. 여기 경로를 박으면 한쪽에서 404 다.
|
||||
const from = (location.state as {from?: string} | null)?.from ?? '/';
|
||||
// ★ 로그인을 마친 사람의 용건은 "내 것"이다 — 사장님 앱은 /sites 로 보낸다.
|
||||
// '/' 로 보내면 방금 로그인해 놓고 랜딩(판매 화면)을 보게 된다.
|
||||
// 내부 운영 앱은 '/' 가 자기 홈으로 리다이렉트하므로 그대로 둔다.
|
||||
const home = selfServe ? '/sites' : '/';
|
||||
const from = (location.state as {from?: string} | null)?.from ?? home;
|
||||
|
||||
if (user) return <Navigate to={from} replace />;
|
||||
|
||||
|
||||
@ -76,7 +76,8 @@ export function SignupPage() {
|
||||
return;
|
||||
}
|
||||
notify.success('가입이 완료되었습니다.');
|
||||
navigate('/', {replace: true});
|
||||
// 가입 직후 갈 곳도 내 것이다 — '/' 는 판매 화면(랜딩)이다.
|
||||
navigate('/sites', {replace: true});
|
||||
} catch (error) {
|
||||
notifyApiError(error, '가입하지 못했습니다.');
|
||||
} finally {
|
||||
@ -97,7 +98,8 @@ export function SignupPage() {
|
||||
notifyApiError({data: res}, '로그인 응답에 토큰이 없습니다.');
|
||||
return;
|
||||
}
|
||||
navigate('/', {replace: true});
|
||||
// 가입 직후 갈 곳도 내 것이다 — '/' 는 판매 화면(랜딩)이다.
|
||||
navigate('/sites', {replace: true});
|
||||
} catch (error) {
|
||||
notifyApiError(error, '구글로 가입하지 못했습니다.');
|
||||
} finally {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user