1
0
forked from baron/baron-sso

라우터 구조 개선 및 리다이렉트 시 파라미터 유실 수정

This commit is contained in:
2026-02-19 13:48:30 +09:00
parent b675159510
commit 95136cd5df
2 changed files with 77 additions and 118 deletions

View File

@@ -75,14 +75,16 @@ String buildLocalizedPath(String localeCode, Uri uri) {
restSegments = segments.skip(1);
}
}
final newSegments = [localeCode, ...restSegments];
final path = '/${newSegments.join('/')}';
final queryPart = uri.hasQuery ? '?${uri.query}' : '';
final fragmentPart = uri.fragment.isNotEmpty ? '#${uri.fragment}' : '';
return '$path$queryPart$fragmentPart';
}
String buildSigninRedirectPath(String localeCode, Uri uri) {
final queryPart = uri.hasQuery ? '?${uri.query}' : '';
return '/$localeCode/signin$queryPart';
final newPath = '/${[localeCode, ...restSegments].join('/')}';
// Return only the path and query part to avoid GoRouter confusion with full URLs
final newUri = uri.replace(path: newPath);
String result = newUri.path;
if (newUri.hasQuery) {
result += '?${newUri.query}';
}
if (newUri.hasFragment) {
result += '#${newUri.fragment}';
}
return result;
}