itube-specs 0.0.257 → 0.0.258
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.
- package/composables/use-fetch-multi-suggest.ts +35 -0
- package/composables/use-fetch-playlists-by-id.ts +18 -0
- package/composables/use-fetch-playlists-by-niche.ts +36 -0
- package/composables/use-fetch-related-searches.ts +17 -0
- package/composables/use-fetch-top-chips-models.ts +20 -0
- package/composables/use-fetch-top-models.ts +24 -0
- package/composables/use-fetch-top-random-categories.ts +18 -0
- package/composables/use-fetch-videos-by-categories.ts +37 -0
- package/composables/use-fetch-videos-by-channel.ts +38 -0
- package/composables/use-fetch-videos-by-model.ts +38 -0
- package/composables/use-fetch-videos-by-tag.ts +38 -0
- package/composables/use-fetch-videos-search-by-niche.ts +35 -0
- package/composables/use-user.ts +1 -1
- package/lib/scheme/select-added-items.ts +1 -1
- package/lib/scheme/select-duration-items.ts +1 -1
- package/lib/scheme/sort-channels.ts +1 -1
- package/lib/scheme/sort-items-default.ts +1 -1
- package/lib/scheme/sort-models.ts +1 -1
- package/lib/scheme/sort-playlists.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EAsyncData } from '../runtime';
|
|
2
|
+
import type { IMultiSuggest } from '../types';
|
|
3
|
+
import { ELanguage } from '../runtime';
|
|
4
|
+
import { useRoute } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
export function useFetchMultiSuggest(
|
|
7
|
+
apiMethod: (...args: any[]) => Promise<IMultiSuggest | null>,
|
|
8
|
+
phrasesLimit: number,
|
|
9
|
+
modelsLimit: number,
|
|
10
|
+
categoriesLimit: number,
|
|
11
|
+
watchRoute = false
|
|
12
|
+
) {
|
|
13
|
+
const route = useRoute();
|
|
14
|
+
const searchValue = useState<string>('searchValue', () => '');
|
|
15
|
+
const { locale } = useI18n();
|
|
16
|
+
const lang = locale.value as ELanguage;
|
|
17
|
+
|
|
18
|
+
const { data, status } = useAsyncData<IMultiSuggest | null>(
|
|
19
|
+
watchRoute ? EAsyncData.MultiSuggestRouteSearch : EAsyncData.MultiSuggestSearch,
|
|
20
|
+
() => useApiFetcher<IMultiSuggest | null>(
|
|
21
|
+
EAsyncData.Channels,
|
|
22
|
+
apiMethod,
|
|
23
|
+
lang,
|
|
24
|
+
watchRoute ? useSlug().value : searchValue.value,
|
|
25
|
+
phrasesLimit,
|
|
26
|
+
modelsLimit,
|
|
27
|
+
categoriesLimit
|
|
28
|
+
)(),
|
|
29
|
+
{
|
|
30
|
+
watch: [() => watchRoute ? String(route.params?.slug) : searchValue.value],
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return { data, status };
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useRoute } from 'vue-router';
|
|
2
|
+
import { EAsyncData } from '../runtime';
|
|
3
|
+
import type { IPlaylistInfoType } from '../types';
|
|
4
|
+
|
|
5
|
+
export const useFetchPlaylistsById = async (apiMethod: (...args: any[]) => Promise<IPlaylistInfoType>) => {
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
|
|
8
|
+
const { data, status, error, refresh } = await useAsyncData<IPlaylistInfoType>(
|
|
9
|
+
EAsyncData.PlaylistById,
|
|
10
|
+
() => useApiFetcher<IPlaylistInfoType>(
|
|
11
|
+
EAsyncData.PlaylistById,
|
|
12
|
+
apiMethod,
|
|
13
|
+
String(route.params['id'])
|
|
14
|
+
)(),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return { data, status, error, refresh };
|
|
18
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useRoute } from 'vue-router';
|
|
2
|
+
import { EAsyncData, ELanguage, getSelectedQuery } from '../runtime';
|
|
3
|
+
import { sortPlaylists } from '../lib';
|
|
4
|
+
import type { IPlaylistCard, PaginatedResponse } from '../types';
|
|
5
|
+
|
|
6
|
+
export const useFetchPlaylistsByNiche = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IPlaylistCard>>) => {
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const { locale } = useI18n();
|
|
9
|
+
const lang = locale.value as ELanguage;
|
|
10
|
+
|
|
11
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IPlaylistCard>>(
|
|
12
|
+
EAsyncData.GetPlaylistsByNiche,
|
|
13
|
+
() => useApiFetcher<PaginatedResponse<IPlaylistCard>>(
|
|
14
|
+
EAsyncData.PlaylistById,
|
|
15
|
+
apiMethod,
|
|
16
|
+
{
|
|
17
|
+
page: Number(route.query[ 'page' ]) || 1,
|
|
18
|
+
'per-page': 48,
|
|
19
|
+
},
|
|
20
|
+
getSelectedQuery(route, sortPlaylists) || '-views',
|
|
21
|
+
lang,
|
|
22
|
+
)(),
|
|
23
|
+
{
|
|
24
|
+
watch: [
|
|
25
|
+
() => {
|
|
26
|
+
if (route.query) {
|
|
27
|
+
const currentQuery = route.query;
|
|
28
|
+
return JSON.stringify(currentQuery);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return { data, status, error };
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EAsyncData } from '../runtime';
|
|
2
|
+
import { ELanguage } from '../runtime';
|
|
3
|
+
|
|
4
|
+
export const useFetchRelatedSearch = (apiMethod: (...args: any[]) => Promise<Array<string>>) => {
|
|
5
|
+
const lang = useI18n().locale.value as ELanguage;
|
|
6
|
+
|
|
7
|
+
const { data, status, error } = useAsyncData<Array<string>>(
|
|
8
|
+
EAsyncData.RelatedSearch,
|
|
9
|
+
() => useApiFetcher<Array<string>>(
|
|
10
|
+
EAsyncData.RelatedSearch,
|
|
11
|
+
apiMethod,
|
|
12
|
+
lang,
|
|
13
|
+
)(),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return { data, status, error };
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ELanguage, EAsyncData } from '../runtime';
|
|
2
|
+
import type { IModelTag } from '../types';
|
|
3
|
+
|
|
4
|
+
export const useFetchTopChipsModels = (apiMethod: (...args: any[]) => Promise<IModelTag[]>, cacheId: string) => {
|
|
5
|
+
const { locale } = useI18n();
|
|
6
|
+
|
|
7
|
+
const { data: topChipsModels, refresh, status } = useAsyncData<IModelTag[]>(
|
|
8
|
+
String(EAsyncData.TopChipsModels + cacheId),
|
|
9
|
+
() => useApiFetcher<IModelTag[]>(
|
|
10
|
+
EAsyncData.TopChipsModels,
|
|
11
|
+
apiMethod,
|
|
12
|
+
20,
|
|
13
|
+
0,
|
|
14
|
+
locale.value as ELanguage,
|
|
15
|
+
cacheId,
|
|
16
|
+
)(),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return { topChipsModels, refresh, status };
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage } from '../runtime';
|
|
2
|
+
import { IModelCard, PaginatedResponse } from 'itube-specs';
|
|
3
|
+
|
|
4
|
+
export const useFetchTopModels = (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IModelCard>>, limit: number, eName: EAsyncData | string, cacheId: string) => {
|
|
5
|
+
const { locale } = useI18n();
|
|
6
|
+
|
|
7
|
+
const { data, status, refresh } = useAsyncData(
|
|
8
|
+
String(eName + cacheId),
|
|
9
|
+
() => useApiFetcher<PaginatedResponse<IModelCard>>(
|
|
10
|
+
eName as EAsyncData,
|
|
11
|
+
apiMethod,
|
|
12
|
+
limit,
|
|
13
|
+
0,
|
|
14
|
+
locale.value as ELanguage,
|
|
15
|
+
cacheId
|
|
16
|
+
)(),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
data,
|
|
21
|
+
refresh,
|
|
22
|
+
status,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ELanguage, EAsyncData } from '../runtime';
|
|
2
|
+
import type { IChipsItem } from '../types';
|
|
3
|
+
|
|
4
|
+
export const useFetchTopRandomCategories = (apiMethod: (...args: any[]) => Promise<Array<IChipsItem>>, cacheId: string) => {
|
|
5
|
+
const { locale } = useI18n();
|
|
6
|
+
|
|
7
|
+
const { data: topRandomCategories, refresh, error } = useAsyncData<Array<IChipsItem>>(
|
|
8
|
+
String(EAsyncData.CategoriesTopRandom + cacheId),
|
|
9
|
+
() => useApiFetcher<Array<IChipsItem>>(
|
|
10
|
+
EAsyncData.CategoriesTopRandom,
|
|
11
|
+
apiMethod,
|
|
12
|
+
locale.value as ELanguage,
|
|
13
|
+
cacheId
|
|
14
|
+
)(),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return { topRandomCategories, refresh, error };
|
|
18
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage, getSelectedQuery } from '../runtime';
|
|
2
|
+
import type { IVideoCard, PaginatedResponse } from '../types';
|
|
3
|
+
import { useRoute } from 'vue-router';
|
|
4
|
+
import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../lib';
|
|
5
|
+
|
|
6
|
+
export const useFetchVideosByCategories = async (
|
|
7
|
+
apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>
|
|
8
|
+
) => {
|
|
9
|
+
const route = useRoute();
|
|
10
|
+
const lang = useI18n().locale.value as ELanguage;
|
|
11
|
+
|
|
12
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
|
|
13
|
+
EAsyncData.VideosByCategory,
|
|
14
|
+
() => useApiFetcher<PaginatedResponse<IVideoCard>>(
|
|
15
|
+
EAsyncData.VideosByCategory,
|
|
16
|
+
apiMethod,
|
|
17
|
+
lang,
|
|
18
|
+
{
|
|
19
|
+
page: Number(route.query[ 'page' ]) || 1,
|
|
20
|
+
'per-page': 48,
|
|
21
|
+
},
|
|
22
|
+
useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems),
|
|
23
|
+
useSlug().value,
|
|
24
|
+
getSelectedQuery(route, sortItemsDefault) || '-popularity'
|
|
25
|
+
)(),
|
|
26
|
+
{
|
|
27
|
+
watch: [() => {
|
|
28
|
+
if (route.query) {
|
|
29
|
+
const currentQuery = route.query;
|
|
30
|
+
return JSON.stringify(currentQuery);
|
|
31
|
+
}
|
|
32
|
+
}],
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return { data, status, error };
|
|
37
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage, getSelectedQuery } from '../runtime';
|
|
2
|
+
import type { IVideoCard, PaginatedResponse } from '../types';
|
|
3
|
+
import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../lib';
|
|
4
|
+
import { useRoute } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
export const useFetchVideosByChannel = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const { locale } = useI18n();
|
|
9
|
+
const lang = locale.value as ELanguage;
|
|
10
|
+
|
|
11
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
|
|
12
|
+
EAsyncData.VideosByChannel,
|
|
13
|
+
() => useApiFetcher<PaginatedResponse<IVideoCard>>(
|
|
14
|
+
EAsyncData.VideosByChannel,
|
|
15
|
+
apiMethod,
|
|
16
|
+
{
|
|
17
|
+
page: Number(route.query[ 'page' ]) || 1,
|
|
18
|
+
'per-page': 48,
|
|
19
|
+
},
|
|
20
|
+
useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems),
|
|
21
|
+
useSlug().value,
|
|
22
|
+
lang,
|
|
23
|
+
getSelectedQuery(route, sortItemsDefault) || '-popularity'
|
|
24
|
+
)(),
|
|
25
|
+
{
|
|
26
|
+
watch: [
|
|
27
|
+
() => {
|
|
28
|
+
if (route.query) {
|
|
29
|
+
const currentQuery = route.query;
|
|
30
|
+
return JSON.stringify(currentQuery);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return { data, status, error };
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage, getSelectedQuery } from '../runtime';
|
|
2
|
+
import type { IVideoCard, PaginatedResponse } from '../types';
|
|
3
|
+
import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../lib';
|
|
4
|
+
import { useRoute } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
export const useFetchVideosByModel = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const { locale } = useI18n();
|
|
9
|
+
const lang = locale.value as ELanguage;
|
|
10
|
+
|
|
11
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
|
|
12
|
+
EAsyncData.ModelsVideos,
|
|
13
|
+
() => useApiFetcher<PaginatedResponse<IVideoCard>>(
|
|
14
|
+
EAsyncData.ModelsVideos,
|
|
15
|
+
apiMethod,
|
|
16
|
+
{
|
|
17
|
+
page: Number(route.query['page']) || 1,
|
|
18
|
+
'per-page': 48,
|
|
19
|
+
},
|
|
20
|
+
useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems),
|
|
21
|
+
useSlug().value,
|
|
22
|
+
lang,
|
|
23
|
+
getSelectedQuery(route, sortItemsDefault) || '-popularity'
|
|
24
|
+
)(),
|
|
25
|
+
{
|
|
26
|
+
watch: [
|
|
27
|
+
() => {
|
|
28
|
+
if (route.query) {
|
|
29
|
+
const currentQuery = route.query;
|
|
30
|
+
return JSON.stringify(currentQuery);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return { data, status, error };
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage, getSelectedQuery } from '../runtime';
|
|
2
|
+
import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../lib';
|
|
3
|
+
import { useRoute } from 'vue-router';
|
|
4
|
+
import type { IVideoCard, PaginatedResponse } from '../types';
|
|
5
|
+
|
|
6
|
+
export const useFetchVideosByTag = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
|
|
7
|
+
const route = useRoute();
|
|
8
|
+
const { locale } = useI18n();
|
|
9
|
+
const lang = locale.value as ELanguage;
|
|
10
|
+
|
|
11
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
|
|
12
|
+
EAsyncData.VideosByTag,
|
|
13
|
+
() => useApiFetcher<PaginatedResponse<IVideoCard>>(
|
|
14
|
+
EAsyncData.VideosByTag,
|
|
15
|
+
apiMethod,
|
|
16
|
+
{
|
|
17
|
+
page: Number(route.query[ 'page' ]) || 1,
|
|
18
|
+
'per-page': 48,
|
|
19
|
+
},
|
|
20
|
+
useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems),
|
|
21
|
+
useSlug().value,
|
|
22
|
+
lang,
|
|
23
|
+
getSelectedQuery(route, sortItemsDefault) || '-popularity'
|
|
24
|
+
)(),
|
|
25
|
+
{
|
|
26
|
+
watch: [
|
|
27
|
+
() => {
|
|
28
|
+
if (route.query) {
|
|
29
|
+
const currentQuery = route.query;
|
|
30
|
+
return JSON.stringify(currentQuery);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return { data, status, error };
|
|
38
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EAsyncData, ELanguage } from '../runtime';
|
|
2
|
+
import type { IVideoCard, PaginatedResponse } from '../types';
|
|
3
|
+
import { useRoute } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
export const useFetchVideosSearchByNiche = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
|
|
6
|
+
const { locale } = useI18n();
|
|
7
|
+
const lang = locale.value as ELanguage;
|
|
8
|
+
const route = useRoute();
|
|
9
|
+
|
|
10
|
+
const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
|
|
11
|
+
EAsyncData.VideosBySearch,
|
|
12
|
+
() => useApiFetcher<PaginatedResponse<IVideoCard>>(
|
|
13
|
+
EAsyncData.VideosBySearch,
|
|
14
|
+
apiMethod,
|
|
15
|
+
{
|
|
16
|
+
page: Number(route.query[ 'page' ]) || 1,
|
|
17
|
+
'per-page': 48,
|
|
18
|
+
},
|
|
19
|
+
lang,
|
|
20
|
+
useSlug().value,
|
|
21
|
+
)(),
|
|
22
|
+
{
|
|
23
|
+
watch: [
|
|
24
|
+
() => {
|
|
25
|
+
if (route.query) {
|
|
26
|
+
const currentQuery = route.query;
|
|
27
|
+
return JSON.stringify(currentQuery);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return { data, status, error };
|
|
35
|
+
};
|
package/composables/use-user.ts
CHANGED