Added env check
This commit is contained in:
parent
0d42f6ac24
commit
c5024d7b69
|
|
@ -1,7 +1,11 @@
|
||||||
import { hc } from "hono/client";
|
import { hc } from "hono/client";
|
||||||
import { AppType } from "backend";
|
import { AppType } from "backend";
|
||||||
|
|
||||||
const client = hc<AppType>("http://localhost:3000", {
|
const backendUrl = import.meta.env.VITE_BACKEND_BASE_URL as string | undefined;
|
||||||
|
|
||||||
|
if (!backendUrl) throw new Error("Backend URL not set");
|
||||||
|
|
||||||
|
const client = hc<AppType>(backendUrl, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${localStorage.getItem("accessToken")}`,
|
Authorization: `Bearer ${localStorage.getItem("accessToken")}`,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user