mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-27 22:25:58 +02:00
automatically set the base url
This commit is contained in:
parent
29777da430
commit
0838679120
4 changed files with 40 additions and 38 deletions
|
@ -44,7 +44,7 @@ const environmentSchema = z.object({
|
||||||
EMAIL_SMTP_USER: z.string().optional(),
|
EMAIL_SMTP_USER: z.string().optional(),
|
||||||
EMAIL_SMTP_PASS: z.string().optional(),
|
EMAIL_SMTP_PASS: z.string().optional(),
|
||||||
EMAIL_NOREPLY: z.string().email().optional(),
|
EMAIL_NOREPLY: z.string().email().optional(),
|
||||||
SITE_DOMAIN: z
|
BASE_URL: z
|
||||||
.string()
|
.string()
|
||||||
.optional()
|
.optional()
|
||||||
.transform((val) => {
|
.transform((val) => {
|
||||||
|
@ -73,7 +73,7 @@ const environment = {
|
||||||
EMAIL_SMTP_USER: process.env.EMAIL_SMTP_USER as string,
|
EMAIL_SMTP_USER: process.env.EMAIL_SMTP_USER as string,
|
||||||
EMAIL_SMTP_PASS: process.env.EMAIL_SMTP_PASS as string,
|
EMAIL_SMTP_PASS: process.env.EMAIL_SMTP_PASS as string,
|
||||||
EMAIL_NOREPLY: process.env.EMAIL_NOREPLY as string,
|
EMAIL_NOREPLY: process.env.EMAIL_NOREPLY as string,
|
||||||
SITE_DOMAIN: process.env.NEXT_PUBLIC_SITE_DOMAIN as string,
|
BASE_URL: process.env.BASE_URL as string,
|
||||||
};
|
};
|
||||||
|
|
||||||
const parsedConfig = environmentSchema.safeParse(environment);
|
const parsedConfig = environmentSchema.safeParse(environment);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
|
const baseURL = `${window.location.protocol}//${window.location.host}/api/v1`;
|
||||||
|
|
||||||
export const api = axios.create({
|
export const api = axios.create({
|
||||||
baseURL: `http://${process.env.NEXT_PUBLIC_SITE_DOMAIN || "localhost:3000"}/api/v1`,
|
baseURL,
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
|
@ -24,8 +24,8 @@ import {
|
||||||
} from "@/components/ui/card";
|
} from "@/components/ui/card";
|
||||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
|
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
|
||||||
import api from "@app/api";
|
import { LoginResponse } from "@server/routers/auth";
|
||||||
import { LoginBody, LoginResponse } from "@server/routers/auth";
|
import { api } from "@app/api";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
email: z.string().email({ message: "Invalid email address" }),
|
email: z.string().email({ message: "Invalid email address" }),
|
||||||
|
@ -48,7 +48,7 @@ export default function LoginForm() {
|
||||||
async function onSubmit(values: z.infer<typeof formSchema>) {
|
async function onSubmit(values: z.infer<typeof formSchema>) {
|
||||||
const { email, password } = values;
|
const { email, password } = values;
|
||||||
const res = await api
|
const res = await api
|
||||||
.post<LoginBody, LoginResponse>("/auth/login", {
|
.post<LoginResponse>("/auth/login", {
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,47 +3,47 @@
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
@layer base {
|
@layer base {
|
||||||
:root {
|
:root {
|
||||||
--background: 31 100% 100%;
|
--background: 37 100% 100%;
|
||||||
--foreground: 31 5% 10%;
|
--foreground: 37 5% 10%;
|
||||||
--card: 31 50% 100%;
|
--card: 37 50% 100%;
|
||||||
--card-foreground: 31 5% 15%;
|
--card-foreground: 37 5% 15%;
|
||||||
--popover: 31 100% 100%;
|
--popover: 37 100% 100%;
|
||||||
--popover-foreground: 31 100% 10%;
|
--popover-foreground: 37 100% 10%;
|
||||||
--primary: 31 11% 28%;
|
--primary: 37 8% 51%;
|
||||||
--primary-foreground: 0 0% 100%;
|
--primary-foreground: 0 0% 100%;
|
||||||
--secondary: 31 30% 90%;
|
--secondary: 37 30% 90%;
|
||||||
--secondary-foreground: 0 0% 0%;
|
--secondary-foreground: 0 0% 0%;
|
||||||
--muted: -7 30% 95%;
|
--muted: -1 30% 95%;
|
||||||
--muted-foreground: 31 5% 40%;
|
--muted-foreground: 37 5% 40%;
|
||||||
--accent: -7 30% 90%;
|
--accent: -1 30% 90%;
|
||||||
--accent-foreground: 31 5% 15%;
|
--accent-foreground: 37 5% 15%;
|
||||||
--destructive: 0 100% 50%;
|
--destructive: 0 100% 50%;
|
||||||
--destructive-foreground: 31 5% 100%;
|
--destructive-foreground: 37 5% 100%;
|
||||||
--border: 31 30% 82%;
|
--border: 37 30% 82%;
|
||||||
--input: 31 30% 50%;
|
--input: 37 30% 50%;
|
||||||
--ring: 31 11% 28%;
|
--ring: 37 8% 51%;
|
||||||
--radius: 0rem;
|
--radius: 0rem;
|
||||||
}
|
}
|
||||||
.dark {
|
.dark {
|
||||||
--background: 31 50% 10%;
|
--background: 37 50% 10%;
|
||||||
--foreground: 31 5% 100%;
|
--foreground: 37 5% 100%;
|
||||||
--card: 31 50% 10%;
|
--card: 37 50% 10%;
|
||||||
--card-foreground: 31 5% 100%;
|
--card-foreground: 37 5% 100%;
|
||||||
--popover: 31 50% 5%;
|
--popover: 37 50% 5%;
|
||||||
--popover-foreground: 31 5% 100%;
|
--popover-foreground: 37 5% 100%;
|
||||||
--primary: 31 11% 28%;
|
--primary: 37 8% 51%;
|
||||||
--primary-foreground: 0 0% 100%;
|
--primary-foreground: 0 0% 100%;
|
||||||
--secondary: 31 30% 20%;
|
--secondary: 37 30% 20%;
|
||||||
--secondary-foreground: 0 0% 100%;
|
--secondary-foreground: 0 0% 100%;
|
||||||
--muted: -7 30% 25%;
|
--muted: -1 30% 25%;
|
||||||
--muted-foreground: 31 5% 65%;
|
--muted-foreground: 37 5% 65%;
|
||||||
--accent: -7 30% 25%;
|
--accent: -1 30% 25%;
|
||||||
--accent-foreground: 31 5% 95%;
|
--accent-foreground: 37 5% 95%;
|
||||||
--destructive: 0 100% 50%;
|
--destructive: 0 100% 50%;
|
||||||
--destructive-foreground: 31 5% 100%;
|
--destructive-foreground: 37 5% 100%;
|
||||||
--border: 31 30% 50%;
|
--border: 37 30% 50%;
|
||||||
--input: 31 30% 50%;
|
--input: 37 30% 50%;
|
||||||
--ring: 31 11% 28%;
|
--ring: 37 8% 51%;
|
||||||
--radius: 0rem;
|
--radius: 0rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue