This commit is contained in:
Jordi Enric
2024-03-10 15:45:54 +01:00
parent 8ee9e56223
commit 2d505a2857
6 changed files with 8 additions and 21 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ type Props = {};
const index = async (props: Props) => {
const cms = createClient({
blogId: "673a21e5-145f-4c7f-815d-5627ac681f8e",
_url: "http://localhost:3000/api/public",
_url: `${process.env.NEXT_PUBLIC_API_URL}/public`,
});
const posts = await cms.posts.getAll();
+1 -1
View File
@@ -3,7 +3,7 @@ import { createClient } from "zenblog";
export const getBlogClient = () => {
const blog = createClient({
blogId: "fc966b9f-419c-4c40-a941-c1122cac8875",
_url: "http://localhost:3000/api/public",
_url: process.env.NEXT_PUBLIC_API_URL + "/public",
debug: true,
});
-17
View File
@@ -1,17 +0,0 @@
import { z } from "zod";
const envSchema = z.object({
ZENDO_API_TOKEN: z.string(),
});
export type Env = z.infer<typeof envSchema>;
export function getEnv(): Env {
const env = process.env;
const parsed = envSchema.safeParse(env);
if (!parsed.success) {
throw new Error(parsed.error.message);
}
return parsed.data;
}
+1 -1
View File
@@ -91,7 +91,7 @@ const handler: NextApiHandler = async (req, res) => {
const session = await stripe.billingPortal.sessions.create({
customer: customer.id,
configuration: configuration.id,
return_url: "http://localhost:3000/account",
return_url: process.env.NEXT_PUBLIC_API_URL + "/account",
});
res.status(200).json({ session: session.url });
} catch (error) {
+1 -1
View File
@@ -4,7 +4,7 @@ export const getBlog = () => {
const blog = createClient({
blogId: "53a970ef-cc74-40ac-ac53-c322cd4848cb",
debug: true,
_url: "http://localhost:3000/api/public",
_url: process.env.NEXT_PUBLIC_API_URL + "/public",
});
return blog;
+4
View File
@@ -0,0 +1,4 @@
# Things to clean up
- [ ] Refactor use of env variables so that they are not used directly in the code
- [ ] Remove all console.log statements