forked from baron/baron-sso
feat: i18n 개선 및 userfront 로그인/로케일 보완
This commit is contained in:
5
userfront/test/helpers/web_storage.dart
Normal file
5
userfront/test/helpers/web_storage.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'web_storage_stub.dart'
|
||||
if (dart.library.html) 'web_storage_web.dart';
|
||||
|
||||
export 'web_storage_stub.dart'
|
||||
if (dart.library.html) 'web_storage_web.dart';
|
||||
21
userfront/test/helpers/web_storage_stub.dart
Normal file
21
userfront/test/helpers/web_storage_stub.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
class WebStorage {
|
||||
bool get isWeb => false;
|
||||
|
||||
String? get(String key) => null;
|
||||
|
||||
void set(String key, String value) {}
|
||||
|
||||
String? getSession(String key) => null;
|
||||
|
||||
void setSession(String key, String value) {}
|
||||
|
||||
void removeSession(String key) {}
|
||||
|
||||
void clearSession() {}
|
||||
|
||||
void remove(String key) {}
|
||||
|
||||
void clear() {}
|
||||
}
|
||||
|
||||
final webStorage = WebStorage();
|
||||
37
userfront/test/helpers/web_storage_web.dart
Normal file
37
userfront/test/helpers/web_storage_web.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
// ignore_for_file: avoid_web_libraries_in_flutter
|
||||
|
||||
import 'dart:html' as html;
|
||||
|
||||
class WebStorage {
|
||||
bool get isWeb => true;
|
||||
|
||||
String? get(String key) => html.window.localStorage[key];
|
||||
|
||||
void set(String key, String value) {
|
||||
html.window.localStorage[key] = value;
|
||||
}
|
||||
|
||||
String? getSession(String key) => html.window.sessionStorage[key];
|
||||
|
||||
void setSession(String key, String value) {
|
||||
html.window.sessionStorage[key] = value;
|
||||
}
|
||||
|
||||
void removeSession(String key) {
|
||||
html.window.sessionStorage.remove(key);
|
||||
}
|
||||
|
||||
void clearSession() {
|
||||
html.window.sessionStorage.clear();
|
||||
}
|
||||
|
||||
void remove(String key) {
|
||||
html.window.localStorage.remove(key);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
html.window.localStorage.clear();
|
||||
}
|
||||
}
|
||||
|
||||
final webStorage = WebStorage();
|
||||
Reference in New Issue
Block a user