itube-specs 0.0.799 → 0.0.800
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Language } from '../../runtime';
|
|
2
|
-
import { AsyncData } from '../../runtime';
|
|
2
|
+
import { AsyncData, convertString } from '../../runtime';
|
|
3
3
|
import type { IVideoData } from '../../types';
|
|
4
4
|
|
|
5
5
|
// Роут-источник (без суффикса локали) → тип referer'а и параметр роута со значением.
|
|
@@ -36,7 +36,13 @@ export const useFetchVideo = async (
|
|
|
36
36
|
const rule = REFERER_BY_ROUTE[name];
|
|
37
37
|
if (!rule) return null;
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const raw = String(from.params[rule.param] || '');
|
|
40
|
+
if (!raw) return null;
|
|
41
|
+
|
|
42
|
+
// Декодируем так же, как useSlug — бек принимает referer_value в том же виде,
|
|
43
|
+
// что и slug в остальных методах (напр. useFetchCategoriesByName).
|
|
44
|
+
const decoded = convertString().fromSlug(raw);
|
|
45
|
+
const value = String(Array.isArray(decoded) ? decoded[0] : decoded);
|
|
40
46
|
return value ? { type: rule.type, value } : null;
|
|
41
47
|
});
|
|
42
48
|
|