|
|
@@ -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
|