Skip to content

Commit

Permalink
setup medusa client
Browse files Browse the repository at this point in the history
  • Loading branch information
yinkakun committed Oct 23, 2022
1 parent 78e9220 commit 293ea77
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions storefront/lib/medusa-client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Medusa from '@medusajs/medusa-js';

const MEDUSA_SERVER_URL = process.env.NEXT_PUBLIC_MEDUSA_SERVER_URL;

const createMedusaClient = () => {
if (!MEDUSA_SERVER_URL) {
throw new Error('Missing Medusa server URL');
}

return new Medusa({
maxRetries: 3,
baseUrl: MEDUSA_SERVER_URL,
});
};

export const medusaClient = createMedusaClient();

0 comments on commit 293ea77

Please sign in to comment.