fix: email sending
This commit is contained in:
parent
4200e41987
commit
8a283f46e7
2 changed files with 10 additions and 8 deletions
|
@ -1,16 +1,18 @@
|
|||
import { Controller, Get, Redirect } from '@nestjs/common';
|
||||
import { Controller, Get, Redirect, UseGuards } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
import { PostalClientService } from 'nestjs-postal-client';
|
||||
import { LoginGuard } from './auth/guard/login.guard';
|
||||
import { MailService } from './mail/mail.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(
|
||||
private readonly appService: AppService,
|
||||
private readonly postal: PostalClientService,
|
||||
private readonly mailService: MailService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@Redirect('/auth/login')
|
||||
@UseGuards(LoginGuard)
|
||||
getHello(): any {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ export class MailService {
|
|||
* @returns The content of the template
|
||||
*/
|
||||
private async readHtmlTemplate(templateName: string): Promise<string> {
|
||||
return await readFile(
|
||||
path.join(__dirname, '../..', 'mail/html', `${templateName}.hbs`),
|
||||
return (
|
||||
await readFile(path.join(__dirname, '../..', 'mail/html', `${templateName}.hbs`))
|
||||
).toString();
|
||||
}
|
||||
|
||||
|
@ -121,8 +121,8 @@ export class MailService {
|
|||
* @returns The content of the template
|
||||
*/
|
||||
private async readTextTemplate(templateName: string): Promise<string> {
|
||||
return await readFile(
|
||||
path.join(__dirname, '../..', 'mail/text', `${templateName}.txt`),
|
||||
return (
|
||||
await readFile(path.join(__dirname, '../..', 'mail/text', `${templateName}.txt`))
|
||||
).toString();
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ export class MailService {
|
|||
* @returns The content of the template
|
||||
*/
|
||||
private async fetchTemplate(templateName: string): Promise<{ html: string; text: string }> {
|
||||
// await both promises
|
||||
// await both promises for html and text
|
||||
const [html, text] = await Promise.all([
|
||||
this.readHtmlTemplate(templateName),
|
||||
this.readTextTemplate(templateName),
|
||||
|
|
Loading…
Reference in a new issue