mall-app-t/peach/api/member/auth.js

57 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-05-29 17:07:37 +08:00
import request from '@/peach/request'
2024-05-22 15:42:13 +08:00
const AuthUtil = {
2024-05-29 17:07:37 +08:00
smsLogin: (data) => {
return request({
url: '/particulars/member/auth/sms-login',
method: 'POST',
data,
custom: {
showSuccess: true,
loadingMsg: '登陆中',
successMsg: '登陆成功',
auth: false,
},
})
},
2024-05-30 18:57:02 +08:00
// 退出登陆
logout: () => {
return request({
url: '/particulars/member/auth/logout',
method: 'POST',
})
},
2024-05-29 17:07:37 +08:00
// 发送手机验证码
sendSmsCode: (mobile, scene) => {
return request({
url: '/member/auth/send-sms-code',
method: 'POST',
data: {
mobile,
scene,
},
custom: {
loadingMsg: '发送中',
showSuccess: true,
successMsg: '发送成功',
},
})
},
// 刷新令牌
refreshToken: (refreshToken) => {
return request({
2024-05-30 18:57:02 +08:00
url: '/particulars/member/auth/refresh-token',
2024-05-29 17:07:37 +08:00
method: 'POST',
params: {
refreshToken,
},
custom: {
loading: false, // 不用加载中
showError: false, // 不展示错误提示
},
})
},
}
2024-05-22 15:42:13 +08:00
2024-05-29 17:07:37 +08:00
export default AuthUtil