Skip to content

Commit

Permalink
Refactor Shopify class to streamline token and router properties
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Nov 22, 2024
1 parent cc43d63 commit 87c761b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Sources/ImperialShopify/Shopify.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import Vapor

public final class Shopify: FederatedService {
public var tokens: any FederatedServiceTokens { self.router.tokens }
public var router: any FederatedServiceRouter { self.shopifyRouter }

public let shopifyRouter: ShopifyRouter
public let tokens: any FederatedServiceTokens
public let router: any FederatedServiceRouter

public init(
routes: some RoutesBuilder,
Expand All @@ -15,7 +13,8 @@ public final class Shopify: FederatedService {
scope: [String],
completion: @escaping @Sendable (Request, String) async throws -> some AsyncResponseEncodable
) throws {
self.shopifyRouter = try ShopifyRouter(callback: callback, scope: scope, completion: completion)
self.router = try ShopifyRouter(callback: callback, scope: scope, completion: completion)
self.tokens = self.router.tokens

try self.router.configureRoutes(
withAuthURL: authenticate,
Expand Down
3 changes: 2 additions & 1 deletion Sources/ImperialShopify/ShopifyRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ final public class ShopifyRouter: FederatedServiceRouter {
ShopifyCallbackBody(
code: code,
clientId: tokens.clientID,
clientSecret: tokens.clientSecret)
clientSecret: tokens.clientSecret
)
}

/// Gets an access token from an OAuth provider.
Expand Down

0 comments on commit 87c761b

Please sign in to comment.