You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
620 B
26 lines
620 B
2 years ago
|
import 'dart:convert';
|
||
|
|
||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||
|
|
||
|
import '../js/initial_route.dart';
|
||
|
import '../model/one_user_model.dart';
|
||
|
// ignore: avoid_web_libraries_in_flutter
|
||
|
import 'dart:html' as html;
|
||
|
|
||
|
void redirectToHome() {
|
||
|
html.window.location.href = "/one-ui/";
|
||
|
}
|
||
|
|
||
|
final localAuthProvider = Provider<OneLocalUserModel?>((ref) {
|
||
|
try {
|
||
|
String? user = getUser();
|
||
|
String? token = getToken();
|
||
|
if (user != null) {
|
||
|
final localUser = OneLocalUserModel.fromJson(jsonDecode(user));
|
||
|
localUser.token = token;
|
||
|
return localUser;
|
||
|
}
|
||
|
} catch (_) {}
|
||
|
return null;
|
||
|
});
|