itube-specs 0.0.310 → 0.0.311

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.
@@ -10,21 +10,33 @@ export const useFetchPlaylistsGetVideosById = (
10
10
  const route = useRoute();
11
11
  const id = computed(() => String(route.params[ 'id' ]));
12
12
  const key = EAsyncData.GetPlaylistsVideo;
13
- const stateKey = computed(() => `data-${key}-${id.value}`);
13
+ const stateKey = useState(`data-${key}-${id.value}`);
14
+
15
+ async function fetchData() {
16
+ try {
17
+ const result = await apiMethod(
18
+ id.value,
19
+ isListPage ? {
20
+ page: Number(route.query[ 'page' ]) || 1,
21
+ [ 'per-page' ]: PER_PAGE,
22
+ } : {
23
+ page: 1,
24
+ }
25
+ );
26
+ stateKey.value = result;
27
+ return result;
28
+ } catch (err) {
29
+ throw createError({
30
+ statusCode: 500,
31
+ statusMessage: `Error fetching ${key}`,
32
+ message: err instanceof Error ? err.message : 'An unknown error occurred',
33
+ });
34
+ }
35
+ }
14
36
 
15
37
  const { data, status, error } = useAsyncData<PaginatedResponse<IVideoCard>>(
16
38
  key,
17
- () => useApiFetcher<PaginatedResponse<IVideoCard>>(
18
- null,
19
- apiMethod,
20
- id.value,
21
- isListPage ? {
22
- page: Number(route.query[ 'page' ]) || 1,
23
- [ 'per-page' ]: PER_PAGE,
24
- } : {
25
- page: 1,
26
- },
27
- )(),
39
+ fetchData,
28
40
  );
29
41
 
30
42
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.310",
4
+ "version": "0.0.311",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {