mirror of
https://github.com/jordienr/zenblog.git
synced 2026-08-24 02:34:19 -05:00
fix
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user