Skip to content

Commit

Permalink
@dandi/mvc-hal: use the ResolverContext in order to access request data
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchaffer committed Sep 28, 2018
1 parent d7bf609 commit b9bb56c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mvc-hal/src/default.resource.composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class DefaultResourceComposer implements ResourceComposer {
@Inject(Resolver) private resolver: Resolver,
@Inject(RouteInitializer) private routeInitializer: RouteInitializer,
@Inject(Routes) private routes: Route[],
@Inject(ResolverContext) private resolverContext: ResolverContext<any>,
) {}

public async compose(resource: any, context: CompositionContext): Promise<ComposedResource<any>> {
Expand Down Expand Up @@ -200,7 +201,7 @@ export class DefaultResourceComposer implements ResourceComposer {
rt.controllerCtr === accessor.controller &&
rt.controllerMethod === accessor.method,
);
const ogRequest = (await this.resolver.resolve(MvcRequest)).singleValue;
const ogRequest = (await this.resolver.resolveInContext(this.resolverContext, MvcRequest)).singleValue;
const requestParams = Object.keys(accessor.paramMap).reduce((params, key) => {
params[key] = this.getParamValue(resource, meta, relMeta, key, accessor);
return params;
Expand Down Expand Up @@ -228,7 +229,7 @@ export class DefaultResourceComposer implements ResourceComposer {
status: embedResponseAccess,
};

const requestInfo = (await this.resolver.resolve(RequestInfo)).singleValue;
const requestInfo = (await this.resolver.resolveInContext(this.resolverContext, RequestInfo)).singleValue;
const embedRepo = await this.routeInitializer.initRouteRequest(route, req, requestInfo, res);

embedRepo.register({
Expand Down

0 comments on commit b9bb56c

Please sign in to comment.