weaver_trunk_cli/pc4mobx/portal4public/components/wea-portal-utils/index.js

28 lines
596 B
JavaScript

import { WeaTools } from 'ecCom';
import uuid from 'uuid';
import moment from 'moment';
const getCurrentUser = () => new Promise((resolve) => {
WeaTools.callApi('/api/portal/user/getCurrentUser', 'GET').then((result) => {
const { data = {} } = result;
resolve(data);
});
});
const getUUID = () => uuid.v4();
const getCurrentDate = () => moment().format('YYYY-MM-DD');
const getCurrentTime = () => moment().format('HH:mm:ss');
const WeaPortalUtils = {
uuid,
moment,
getCurrentUser,
getUUID,
getCurrentDate,
getCurrentTime,
};
export default WeaPortalUtils;