vending-machine/mobile/api/user.js
2026-04-08 20:45:41 +08:00

42 lines
793 B
JavaScript

import { get, post, del } from './request.js'
/**
* 发送验证码
* @param {string} phone - 手机号
* @param {string} areaCode - 区号
*/
export function sendCode(phone, areaCode) {
return post('/api/user/send-code', { phone, areaCode })
}
/**
* 手机号验证码登录
* @param {string} phone - 手机号
* @param {string} code - 验证码
* @param {string} areaCode - 区号
*/
export function login(phone, code, areaCode) {
return post('/api/user/login', { phone, code, areaCode })
}
/**
* 获取当前用户信息
*/
export function getUserInfo() {
return get('/api/user/info')
}
/**
* 退出登录
*/
export function logout() {
return post('/api/user/logout')
}
/**
* 注销账号
*/
export function deleteAccount() {
return del('/api/user/account')
}