Explorar o código

fix: get program name is empty

daigang %!s(int64=3) %!d(string=hai) anos
pai
achega
b0a65fa530
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      src/utils/cache.js

+ 9 - 1
src/utils/cache.js

@@ -7,9 +7,17 @@ const nameCache = {
   [ScheduleType.RECUR]: {}
 }
 
+function getProgramName (id) {
+  return getProgram(id, { custom: true }).then(({ data }) => data.name)
+}
+
+function getScheduleName (id) {
+  return getSchedule(id, { custom: true }).then(({ name }) => name)
+}
+
 export function getName (type, id) {
   if (!nameCache[type][id]) {
-    const promise = (type === ScheduleType.CALENDAR ? getProgram : getSchedule)(id, { custom: true }).then(({ name }) => name)
+    const promise = (type === ScheduleType.CALENDAR ? getProgramName : getScheduleName)(id)
     nameCache[type][id] = promise
     promise.catch(() => {
       nameCache[type][id] = null