0.3.2 • Published 4 years ago
kst-auth v0.3.2
KstAuth
统一授权前端类库
使用
Installation
yarn add kst-auth
初始化
- 安装依赖
yarn add jquery bootstrap js-cookie moment
下载
font-awesome4.7
配置依赖
转到
angular.json
,添加配置
"styles": [ "src/assets/font-awesome-4.7.0/css/font-awesome.min.css", "node_modules\bootstrap\dist\css\bootstrap.min.css",
], "scripts": "node_modules\jquery\dist\jquery.slim.min.js", "node_modules\bootstrap\dist\js\bootstrap.min.js"
3. 引入类库
* 在跟模块(一般为`AppModule`)中:
```js
import { AccountModule, AppAccountSession } from 'kst-auth';
- 在应用初始化中(依然在跟模块):
export function appInitializerFactory(injector: Injector) {
const appSession = injector.get(AppAccountSession);
return () => {
return new Promise((reslove, reject) => {
// 应用初始化
// 此处必须条用getCurrentLoginInfo
appSession.getCurrentLoginInfo(() => {
reslove();
});
});
};
}
// ------------------------
providers: [{
provide: APP_INITIALIZER,
useFactory: appInitializerFactory,
deps: [Injector],
multi: true
}]
- 在根路由模块
AppRoutingModule
:
{ path: 'account', loadChildren: () => import('kst-auth').then(mod => mod.AccountModule) }
- 启动查看效果
0.3.2
4 years ago
0.3.1
4 years ago
0.3.0
4 years ago
0.2.0
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago