Chore: Updated resolvers from Class to ResolveFn
This commit is contained in:
13
overlord/src/app/purchase/purchase.resolver.ts
Normal file
13
overlord/src/app/purchase/purchase.resolver.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { Voucher } from '../core/voucher';
|
||||
import { VoucherService } from '../core/voucher.service';
|
||||
|
||||
export const purchaseResolver: ResolveFn<Voucher> = (route) => {
|
||||
const id = route.paramMap.get('id');
|
||||
if (id === null) {
|
||||
return inject(VoucherService).getOfType('Purchase');
|
||||
}
|
||||
return inject(VoucherService).get(id, 'Purchase');
|
||||
};
|
||||
Reference in New Issue
Block a user