user.ts 757 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { WX_GET_PHONE, WX_GET_USER } from '../utils/apiList'
  2. import { request, Response } from '../utils/http'
  3. interface PhoneParams {
  4. code: string
  5. encryptedData: string
  6. iv: string
  7. }
  8. interface PhoneResType {
  9. countryCode: string
  10. phoneNumber: string
  11. purePhoneNumber: string
  12. }
  13. interface UserResType {
  14. }
  15. type UserRes = Response & {
  16. data: PhoneRes
  17. }
  18. type PhoneRes = Response & {
  19. data: PhoneResType
  20. }
  21. export const getUserInfo = async (): Promise<UserResType> => {
  22. const res = await request.get<UserRes>(WX_GET_USER)
  23. return res.data
  24. }
  25. export const decrptPhone = async (params: PhoneParams): Promise<PhoneResType> => {
  26. const res = await request.get<PhoneRes>(WX_GET_PHONE, params)
  27. return res.data
  28. }