@flexem/utils
v0.2.4
Published
flexem utils
Downloads
10
Keywords
Readme
公共方法库
npm install @flexem/utils
或者
yarn add @flexem/utils
1、 cookie 相关操作
import { getCookie, setCookie, removeCookie } from '@flexem/utils';
getCookie(cookieName: string, defaultValue = '');
setCookie(domain:string, cookieName: string, value: string, defaultDays = 90);
removeCookie(domain:string, cookieName: string);
2、exec 执行方法
import exec from '@flexem/utils/dist/src/exec';
const [err, currentUser] = await exec(queryCurrent());
if (err) {
removeCookie(AppConfig.domain, AppConsts.accessToken);
window.location.href = AppConfig.loginUrl;
} else {
return currentUser;
}
3、生成16位guid
import { GuidGenerator } from '@flexem/utils';
GuidGenerator.newGuid()