File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ export * from './templates/base';
5
5
export * from './templates/formatted-date-time' ;
6
6
export * from './templates/frontend-url' ;
7
7
export * from './templates/user-ref' ;
8
+ export * from './templates/useConfig' ;
8
9
export * from './templates/useResources' ;
Original file line number Diff line number Diff line change 1
- import { useModuleRef } from '@seedcompany/nestjs-email/templates' ;
2
1
import { DateTime , type Zone } from 'luxon' ;
3
- import { ConfigService } from '~/core ' ;
2
+ import { useConfig } from './useConfig ' ;
4
3
5
4
type ZoneLike = string | Zone ;
6
5
@@ -10,7 +9,7 @@ export interface FormattedDateTimeProps {
10
9
}
11
10
12
11
export const FormattedDateTime = ( props : FormattedDateTimeProps ) => {
13
- const config = useModuleRef ( ) . get ( ConfigService ) ;
12
+ const config = useConfig ( ) ;
14
13
const formatted = props . value
15
14
. setZone ( props . timezone ?? config . defaultTimeZone )
16
15
. toLocaleString ( DateTime . DATETIME_FULL ) ;
Original file line number Diff line number Diff line change 1
- import { useModuleRef } from '@seedcompany/nestjs-email/templates' ;
2
- import { ConfigService } from '~/core/config/config.service' ;
1
+ import { useConfig } from './useConfig' ;
3
2
4
3
export const useFrontendUrl = ( path : string ) => {
5
4
path = path . startsWith ( '/' ) ? path . slice ( 1 ) : path ;
6
- const config = useModuleRef ( ) . get ( ConfigService ) ;
5
+ const config = useConfig ( ) ;
7
6
return new URL ( path , config . frontendUrl ) . toString ( ) ;
8
7
} ;
Original file line number Diff line number Diff line change
1
+ import { useModuleRef } from '@seedcompany/nestjs-email/templates' ;
2
+ import type { ConfigService } from '~/core' ;
3
+
4
+ export const useConfig = ( ) =>
5
+ useModuleRef ( ) . get < ConfigService > ( 'CONFIG' , { strict : false } ) ;
You can’t perform that action at this time.
0 commit comments