File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed
app/components/modules/project/services Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ class ProjectCommunityApiService {
9494 query : ( ) => Record < string , string | number | string [ ] | undefined | null > ,
9595 ) : QueryFunction < Pagination < CommunityMentions > , readonly unknown [ ] , number > {
9696 return async ( { pageParam = 0 } ) =>
97- await $fetch ( `/api/project/ ${ query ( ) . projectSlug } / community` , {
97+ await $fetch ( `/api/community/list ` , {
9898 params : {
9999 page : pageParam ,
100100 ...query ( ) ,
Original file line number Diff line number Diff line change @@ -5,17 +5,16 @@ import { Pagination } from '~~/types/shared/pagination';
55import { CommunityMentions } from '~~/types/community/community' ;
66
77export default defineEventHandler ( async ( event ) : Promise < Pagination < CommunityMentions > > => {
8- const { slug } = event . context . params as Record < string , string > ;
8+ const query = getQuery ( event ) ;
9+ const projectSlug = query . projectSlug as string ;
910
10- if ( ! slug ) {
11+ if ( ! projectSlug ) {
1112 throw createError ( {
1213 statusCode : 400 ,
1314 statusMessage : 'Project slug is required' ,
1415 } ) ;
1516 }
1617
17- const query = getQuery ( event ) ;
18-
1918 const page : number = ( query . page as number ) || 0 ;
2019 const pageSize : number = ( query . pageSize as number ) || 20 ;
2120 const platforms = Array . isArray ( query . platforms )
@@ -47,7 +46,7 @@ export default defineEventHandler(async (event): Promise<Pagination<CommunityMen
4746 keywords,
4847 sentiments,
4948 languages,
50- projectSlug : slug ,
49+ projectSlug,
5150 } ) ;
5251
5352 return {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const isJWT = (token: string) => {
1313export default defineEventHandler ( async ( event ) => {
1414 const url = getRouterParam ( event , '_' ) || event . node . req . url || '' ;
1515
16- const protectedRoutes = [ '/api/report' ] ;
16+ const protectedRoutes = [ '/api/report' , '/api/community/list' ] ;
1717 const protectedAndPermissionRoutes = [ '/api/chat' ] ;
1818
1919 const isProtectedRoute = [ ...protectedRoutes , ...protectedAndPermissionRoutes ] . some ( ( route ) =>
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export default {
1515 '/api/health/live' : { cache : false } ,
1616 '/api/seo/og-image' : { cache : false } ,
1717 '/api/report' : { cache : false } ,
18+ '/api/community/list' : { cache : { maxAge : longCache , base : 'redis' } } ,
1819 '/api/community/**' : { cache : false } ,
1920 '/api/search' : { cache : { maxAge : longCache , base : 'redis' } } ,
2021 '/api/category' : { cache : { maxAge : longCache , base : 'redis' } } ,
You can’t perform that action at this time.
0 commit comments