import type { UserInfo } from '~/stores/use-transfer-store'
import { post, get } from '@/utils/request';

export interface LoginParams {
    loginName: string
    password: string
}
export interface TokenInfo {
    data: string
}

export interface RegisterParams extends LoginParams {
    email: string
    phone: string
}

export interface ResetPasswordParams {
    email: string
    code: string
    newPassword: string
}

export const userApi = {
    // 登录
    login: (params: LoginParams) => {
        return post<string>('/custom/login', params)
    },
    // 获取用户信息
    getUserInfo: () => {
        return post<UserInfo>('/custom/info')
    },
    // 获取用户信息
    getUserSingle: () => {
        return post<UserInfo>('/wasabi/api/merchant/user/single', {
            // uniqueId: '63dbefafc83e4b47bc2364a8f6266450',
        })
    },
    // 退出登录
    logout: () => {
        return post('/custom/logout', {})
    },
    // 忘记密码
    updatePassword: (params: { email: string }) => {
        return post('/custom/update/password/send/email', params)
    },
    // 账户
    accountDropdown: (params = {}) => {
        return post('/wasabi/api/account/dropdown', params)
    },
    // 修改密码
    updateEmailPassword: (params = {}) => {
        return post('/custom/update/login/password', params)
    },
}
