Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. const O = async e=>Object(u.b)({
  2. endpoint: `${a.a.streamingApiUrl}/rpan_config_v1`,
  3. method: c.cb.GET,
  4. headers: o()(e.headers, [d.c, d.b])
  5. }).then(T)
  6. , g = async(e,t)=>Object(u.b)({
  7. endpoint: `${a.a.streamingApiUrl}/videos/${t}`,
  8. method: c.cb.GET,
  9. headers: o()(e.headers(), [d.c, d.b])
  10. }).then(T)
  11. , y = async(e,t,r)=>{
  12. const n = t || Math.random().toString()
  13. , i = parseInt(s()(n).toString(), 16) % 1e3;
  14. return Object(u.b)({
  15. endpoint: `${a.a.streamingApiUrl}/videos/seed/${i}${r ? "?subreddit=pan2" : ""}`,
  16. method: c.cb.GET,
  17. headers: o()(e.headers(), [d.c, d.b])
  18. }).then(T)
  19. }
  20. , j = async(e,t,r)=>Object(u.b)({
  21. endpoint: `${a.a.streamingApiUrl}/videos/${t}/vote/${S(r)}`,
  22. method: c.cb.POST,
  23. headers: o()(e.headers, [d.c, d.b])
  24. }).then(T)
  25. , _ = async(e,t)=>Object(u.b)({
  26. endpoint: `${a.a.streamingApiUrl}/videos/${t}/heartbeat`,
  27. method: c.cb.POST,
  28. headers: o()(e.headers, [d.c, d.b])
  29. }).then(T)
  30. , E = async(e,t,r,n)=>{
  31. const s = r.rteState;
  32. if (!s)
  33. return Promise.reject(new Error("Editor state is undefined"));
  34. const i = l.a.getRawText(s);
  35. return i ? h(e, t, i).then(e=>e.ok && e.body && e.body.data ? Object.assign({}, e, {
  36. body: {
  37. parentId: t,
  38. comment: Object.assign({}, Object(b.a)(e.body.data, n), {
  39. media: I(s)
  40. })
  41. },
  42. error: void 0
  43. }) : e) : Promise.reject(new Error("Cannot send empty message"))
  44. }
  45. , h = async(e,t,r)=>Object(u.b)({
  46. endpoint: `${a.a.streamingApiUrl}/videos/${t}/comment`,
  47. method: c.cb.POST,
  48. headers: o()(e.headers, [d.c, d.b]),
  49. data: {
  50. text: r
  51. },
  52. type: "json"
  53. }).then(T)
  54. , I = e=>({
  55. type: "rtjson",
  56. richtextContent: {
  57. document: l.a.toRichTextJSON(e).document
  58. },
  59. rteMode: m.h.RICH_TEXT
  60. })
  61. , T = e=>{
  62. if (e.ok)
  63. return Object.assign({}, e, {
  64. error: void 0
  65. });
  66. {
  67. const t = {
  68. type: 404 === e.status ? c.F.NOT_FOUND_ERROR : c.F.SERVER_ERROR
  69. };
  70. return 429 === e.status && (t.fields = [{
  71. field: "",
  72. msg: Object(p.c)("Try again later")
  73. }]),
  74. Object.assign({}, e, {
  75. error: t
  76. })
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement