Skip to content

Commit

Permalink
perf(theme): send props to index
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Aug 14, 2022
1 parent 8f23678 commit d306dde
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/modules/theme/theme.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import { LinksService } from '../links/links.service';
import { PageService } from '../page/page.service';
import { PostService } from '../post/post.service';
import { UserService } from '../user/user.service';
import { ThemeBasicInterface } from './theme.interface';
import { CategoryType } from '../category/category.model';
import { ConfigsService } from '../configs/configs.service';

@Controller('theme')
@ApiName
export class ThemeController {
constructor(
private readonly themeService: ThemeService,
private readonly configService: ConfigsService,
private readonly postService: PostService,
private readonly pageService: PageService,
private readonly categoryService: CategoryService,
Expand Down Expand Up @@ -93,8 +97,13 @@ export class ThemeController {

@Get('/')
async renderIndex(@Res() res) {
return await res.view(`${(await this.themeService.currentTheme())!.name}/index.ejs`, {
title: '首页',
});
return await res.view(
`${(await this.themeService.currentTheme())!.name}/index.ejs` as string,
{
...(await this.basicProps()),
path: '/',
url: '/',
} as ThemeBasicInterface,
);
}
}

0 comments on commit d306dde

Please sign in to comment.