[staff] Remove .env.local and rename the env var to match main photos apps

This commit is contained in:
Manav Rathi 2024-06-10 14:12:23 +05:30
parent 99833e287c
commit f5a90abbaf
No known key found for this signature in database
5 changed files with 14 additions and 9 deletions

9
infra/staff/.env Normal file
View File

@ -0,0 +1,9 @@
# This is a sample .env file. The env vars defined here can be used to configure
# the app.
#
# For local development, create a new file named `.env.local` and add the
# variables you need there instead of uncommenting them below.
#
# For documentation about the variables, see `src/vite-env.d.ts`.
# VITE_ENTE_API_ORIGIN = http://localhost:8080

View File

@ -1 +0,0 @@
VITE_ENTE_ENDPOINT = http://localhost:8080

View File

@ -1,10 +1,8 @@
import React, { useEffect, useState } from "react";
import { apiOrigin } from "./services/support";
import S from "./utils/strings";
export const App: React.FC = () => {
const [serverUrl /*, setServerUrl */] = useState(
import.meta.env.VITE_ENTE_ENDPOINT || "",
);
const [token, setToken] = useState("");
const [email, setEmail] = useState("");
const [userData, setUserData] = useState<any>(null);
@ -15,7 +13,6 @@ export const App: React.FC = () => {
if (storedToken) {
setToken(storedToken);
}
console.log(import.meta.env.VITE_ENTE_ENDPOINT);
}, []);
useEffect(() => {
@ -28,7 +25,7 @@ export const App: React.FC = () => {
const fetchData = async () => {
try {
const url = `${serverUrl}/admin/user?email=${email}&token=${token}`;
const url = `${apiOrigin}/admin/user?email=${email}&token=${token}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");

View File

@ -1,6 +1,6 @@
import { z } from "zod";
const apiOrigin = import.meta.env.VITE_ENTE_ENDPOINT ?? "https://api.ente.io";
export const apiOrigin = import.meta.env.VITE_ENTE_API_ORIGIN ?? "https://api.ente.io";
const UserDetails = z.object({}).passthrough();

View File

@ -8,9 +8,9 @@ interface ImportMetaEnv {
/**
* Override the origin (scheme://host:port) of Ente's API to connect to.
*
* This is useful when testing or connecting to alternative installations.
* Default is "https://api.ente.io".
*/
readonly VITE_ENTE_ENDPOINT: string | undefined;
readonly VITE_ENTE_API_ORIGIN: string | undefined;
}
interface ImportMeta {