forked from baron/baron-sso
userfront 로그인 후 /dashboard로 이동하게 변경
This commit is contained in:
26
userfront/lib/core/services/null_check_recovery.dart
Normal file
26
userfront/lib/core/services/null_check_recovery.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import '../i18n/locale_utils.dart';
|
||||
|
||||
String? computeNullCheckRecoveryTarget({
|
||||
required Object exception,
|
||||
required Uri uri,
|
||||
required String preferredLocaleCode,
|
||||
}) {
|
||||
final message = exception.toString();
|
||||
if (!message.contains('Null check operator used on a null value')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final localeCode =
|
||||
extractLocaleFromPath(uri) ?? normalizeLocaleCode(preferredLocaleCode);
|
||||
final path = uri.path;
|
||||
final localeRootPath = '/$localeCode';
|
||||
if (path != '/' && path != localeRootPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final target = '/$localeCode/signin';
|
||||
if (path == target) {
|
||||
return null;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:web/web.dart' as web;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'dart:js_interop';
|
||||
import 'auth_token_store.dart';
|
||||
import '../i18n/locale_utils.dart';
|
||||
|
||||
void implSendLoginSuccess(String token) {
|
||||
var effectiveToken = token;
|
||||
@@ -87,8 +88,9 @@ void implSendLoginSuccess(String token) {
|
||||
}
|
||||
|
||||
// No opener and no redirect: fall back to local navigation
|
||||
debugPrint('No opener found. Redirecting to /.');
|
||||
web.window.location.href = '/';
|
||||
final fallbackTarget = buildLocalizedHomePath(Uri.base);
|
||||
debugPrint('No opener found. Redirecting to $fallbackTarget.');
|
||||
web.window.location.href = fallbackTarget;
|
||||
}
|
||||
|
||||
bool implIsPopup() {
|
||||
|
||||
Reference in New Issue
Block a user