feat: 完成全部接口替换为新后端接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { apiRequest } from '../../services/api-request';
|
||||
import { disablePageShareMenu } from '../../base/pageMixin';
|
||||
import { clearUser } from '../../utils/auth';
|
||||
import { clearUser, refreshUser } from '../../utils/auth';
|
||||
|
||||
Page({
|
||||
onLoad() {
|
||||
@@ -22,15 +23,8 @@ Page({
|
||||
async doClearProfile() {
|
||||
wx.showLoading({ title: '处理中...', mask: true });
|
||||
try {
|
||||
const res = await wx.cloud.callFunction({
|
||||
name: 'userSettings',
|
||||
data: { action: 'clearProfile' },
|
||||
});
|
||||
const result = (res?.result as any) || {};
|
||||
if (result.code !== 0) {
|
||||
throw new Error(result.message || '操作失败');
|
||||
}
|
||||
clearUser();
|
||||
await apiRequest('/me/profile', { method: 'DELETE' });
|
||||
await refreshUser();
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: '已删除', icon: 'success' });
|
||||
} catch (e) {
|
||||
@@ -58,15 +52,8 @@ Page({
|
||||
async doDeleteAccount() {
|
||||
wx.showLoading({ title: '处理中...', mask: true });
|
||||
try {
|
||||
const res = await wx.cloud.callFunction({
|
||||
name: 'userSettings',
|
||||
data: { action: 'deleteAccount' },
|
||||
});
|
||||
const result = (res?.result as any) || {};
|
||||
if (result.code !== 0) {
|
||||
throw new Error(result.message || '操作失败');
|
||||
}
|
||||
clearUser();
|
||||
await apiRequest('/me', { method: 'DELETE' });
|
||||
clearUser(true);
|
||||
wx.hideLoading();
|
||||
|
||||
wx.reLaunch({ url: '/pages/home/home' });
|
||||
|
||||
Reference in New Issue
Block a user