Skip to content

Commit

Permalink
fix(web-domains): 온보딩 이후 모임 참여 redirect 수정 (#177)
Browse files Browse the repository at this point in the history
* fix: 온보딩 이후 잘못된 url 경로 수정

* fix: 오류 1

* fix: 마지막 버그 수정

* fix: 온보딩 이미지 수정
  • Loading branch information
LeeJeongHooo authored Aug 29, 2024
1 parent 93e7b01 commit dd935b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getWebDomain } from '@/common';
import { cookies } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server';

Expand All @@ -10,9 +11,7 @@ export async function middleware(request: NextRequest) {
if (!accessToken && !request.nextUrl.pathname.startsWith('/auth')) {
const response = NextResponse.redirect(new URL('/auth', request.url));
if (request.nextUrl.pathname.startsWith('/meeting/participate/closing')) {
const host = request.headers.get('host');
const protocol = request.headers.get('x-forwarded-proto') || 'https';
const originalUrl = `${protocol}://${host}${request.nextUrl.pathname}${request.nextUrl.search}`;
const originalUrl = `${getWebDomain()}${request.nextUrl.pathname}${request.nextUrl.search}`;
response.cookies.set('client_redirect_url', encodeURIComponent(originalUrl));
}
return response;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ export const StartButton = (props: StartButtonProps) => {
const data = await onBoardingComplete();

if (redirectUrl) {
router.push(redirectUrl);
const url = new URL(redirectUrl);
router.push(`${url.pathname}?${url.searchParams}`);
return;
}

// 만약 가입된 모임이 없다면
if (data?.isNotEnteredAnyMeeting) {
router.push('/user');
}
// 만약 가입된 모임이 있다면
// // 만약 가입된 모임이 있다면
else {
router.push('/home');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const OnBoardingScreen = ({ step }: OnBoardingScreenProps) => {
}

const cookieStore = cookies();
const redirectUrl = cookieStore.get('client_redirect_url')?.value ?? '';
const redirectUrl = cookieStore.get('redirect_url')?.value ?? '';

return (
<OnBoardingLayout step={step}>
Expand Down

0 comments on commit dd935b6

Please sign in to comment.