20 lines
529 B
Dart
20 lines
529 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:sk_base_mobile/store/resource.store.dart';
|
|
import 'package:sk_base_mobile/util/util.dart';
|
|
|
|
class AuthMiddleware extends GetMiddleware {
|
|
@override
|
|
RouteSettings? redirect(String? route) {
|
|
bool isExsited = ResourceService.to.resources
|
|
.firstWhereOrNull((element) => element.path == route) !=
|
|
null;
|
|
|
|
if (!isExsited) {
|
|
SnackBarUtil().info('您没有权限');
|
|
return null;
|
|
}
|
|
return null;
|
|
}
|
|
}
|