env validation
This commit is contained in:
@@ -2,6 +2,7 @@ import { createSignal, createEffect, For, Show } from "solid-js";
|
||||
import Dropzone from "./Dropzone";
|
||||
import XCircle from "~/components/icons/XCircle";
|
||||
import AddImageToS3 from "~/lib/s3upload";
|
||||
import { env } from "~/env/client";
|
||||
|
||||
export interface AddAttachmentSectionProps {
|
||||
type: "blog" | "project";
|
||||
@@ -92,7 +93,7 @@ export default function AddAttachmentSection(props: AddAttachmentSectionProps) {
|
||||
|
||||
const copyToClipboard = async (key: string) => {
|
||||
try {
|
||||
const bucketString = import.meta.env.VITE_AWS_BUCKET_STRING || "";
|
||||
const bucketString = env.VITE_AWS_BUCKET_STRING || "";
|
||||
await navigator.clipboard.writeText(bucketString + key);
|
||||
console.log("Text copied to clipboard");
|
||||
} catch (err) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import { api } from "~/lib/api";
|
||||
import CommentSection from "./CommentSection";
|
||||
import CommentDeletionPrompt from "./CommentDeletionPrompt";
|
||||
import EditCommentModal from "./EditCommentModal";
|
||||
import { env } from "~/env/client";
|
||||
|
||||
const MAX_RETRIES = 12;
|
||||
const RETRY_INTERVAL = 5000;
|
||||
@@ -72,7 +73,7 @@ export default function CommentSectionWrapper(
|
||||
return;
|
||||
}
|
||||
|
||||
const websocketUrl = import.meta.env.VITE_WEBSOCKET;
|
||||
const websocketUrl = env.VITE_WEBSOCKET;
|
||||
if (!websocketUrl) {
|
||||
console.error("VITE_WEBSOCKET environment variable not set");
|
||||
return;
|
||||
@@ -192,7 +193,7 @@ export default function CommentSectionWrapper(
|
||||
parentCommentID?: number
|
||||
) => {
|
||||
try {
|
||||
const domain = import.meta.env.VITE_DOMAIN;
|
||||
const domain = env.VITE_DOMAIN;
|
||||
const res = await fetch(
|
||||
`${domain}/api/database/comments/create/blog/${props.id}`,
|
||||
{
|
||||
@@ -228,7 +229,7 @@ export default function CommentSectionWrapper(
|
||||
const id = data.commentID;
|
||||
|
||||
if (body && commenterID && parentCommentID !== undefined && id) {
|
||||
const domain = import.meta.env.VITE_DOMAIN;
|
||||
const domain = env.VITE_DOMAIN;
|
||||
const res = await fetch(
|
||||
`${domain}/api/database/user/public-data/${commenterID}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user