sign.ts 888 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { GET_SIG, GET_ARGOA_SIG, GET_COMMON_SIG } from '../utils/apiList'
  2. import { request, Response } from '../utils/http'
  3. interface SingResType {
  4. expire: number | string,
  5. sdkAppId: number | string,
  6. sign: string,
  7. operatorType: number
  8. }
  9. type RoomDetailRes = Response & {
  10. data: SingResType
  11. }
  12. // export const getRTCSig = async (userId: string): Promise<SingResType> => {
  13. // const res = await request.get<RoomDetailRes>(GET_SIG, {
  14. // userId
  15. // })
  16. // return res.data
  17. // }
  18. export const getRTCSig = async (userId: string | number, roleId: string | number, channelName: string): Promise<SingResType> => {
  19. const res = await request.get<RoomDetailRes>(GET_COMMON_SIG, {
  20. userId,
  21. roleId,
  22. channelName
  23. })
  24. return res.code === 0 ? res.data : {
  25. sdkAppId: '',
  26. expire: '',
  27. sign: '',
  28. operatorType: -1
  29. }
  30. }