mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-10-08 19:45:15 +08:00
fix: version name
This commit is contained in:
34
src/user.js
34
src/user.js
@@ -1,38 +1,28 @@
|
||||
/**
|
||||
* Created by tdzl2003 on 2/13/16.
|
||||
*/
|
||||
|
||||
import {question} from './utils';
|
||||
const {
|
||||
post,
|
||||
get,
|
||||
replaceSession,
|
||||
saveSession,
|
||||
closeSession,
|
||||
} = require('./api');
|
||||
const crypto = require('crypto');
|
||||
import { question } from './utils';
|
||||
import { post, get, replaceSession, saveSession, closeSession } from './api';
|
||||
import crypto from 'crypto';
|
||||
|
||||
function md5(str) {
|
||||
return crypto.createHash('md5').update(str).digest('hex');
|
||||
}
|
||||
|
||||
exports.commands = {
|
||||
login: async function ({args}){
|
||||
const email = args[0] || await question('email:');
|
||||
const pwd = args[1] || await question('password:', true);
|
||||
const {token, info} = await post('/user/login', {
|
||||
export const commands = {
|
||||
login: async function ({ args }) {
|
||||
const email = args[0] || (await question('email:'));
|
||||
const pwd = args[1] || (await question('password:', true));
|
||||
const { token, info } = await post('/user/login', {
|
||||
email,
|
||||
pwd: md5(pwd),
|
||||
});
|
||||
replaceSession({token});
|
||||
replaceSession({ token });
|
||||
await saveSession();
|
||||
console.log(`欢迎使用 pushy 热更新服务, ${info.name}.`);
|
||||
},
|
||||
logout: async function (){
|
||||
logout: async function () {
|
||||
await closeSession();
|
||||
console.log('已退出登录');
|
||||
},
|
||||
me: async function (){
|
||||
me: async function () {
|
||||
const me = await get('/user/me');
|
||||
for (const k in me) {
|
||||
if (k !== 'ok') {
|
||||
@@ -40,4 +30,4 @@ exports.commands = {
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user