Skip to content

Commit

Permalink
Refactor manageAccessToken type
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaansyed committed Nov 15, 2023
1 parent c6ac503 commit 4f2fbeb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class AuthStrategy<

const {sessionContext, shop} = await this.getAuthenticatedSession(request);

return this.strategy.manageAccessToken(sessionContext, shop, request);
return this.strategy.manageAccessToken({sessionContext, shop, request});
}

private async handleBouncePageRoute(request: Request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ export class AuthCodeFlowStrategy<
}
}

async manageAccessToken(
sessionContext: SessionContext | undefined,
shop: string,
request: Request,
): Promise<SessionContext> {
async manageAccessToken({
sessionContext,
shop,
request,
}: {
sessionContext?: SessionContext;
shop: string;
request: Request;
}): Promise<SessionContext> {
const {config, logger, api} = this;
if (
!sessionContext?.session ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import {SessionContext} from '../types';

export interface AuthorizationStrategy {
handleRoutes: (request: Request) => void;
manageAccessToken: (
sessionContext: SessionContext | undefined,
shop: string,
request: Request,
) => Promise<SessionContext>;
manageAccessToken: ({
sessionContext,
shop,
request,
}: {
sessionContext?: SessionContext;
shop: string;
request: Request;
}) => Promise<SessionContext>;
ensureInstalledOnShop: (request: Request) => void;
}

0 comments on commit 4f2fbeb

Please sign in to comment.