refactor: remove now useless api routes on client
This commit is contained in:
parent
78cb3c36ad
commit
f4ec85ed15
4 changed files with 7 additions and 28 deletions
|
@ -8,16 +8,11 @@ interface IReturnProps {
|
|||
isLoadingComplete?: boolean;
|
||||
}
|
||||
|
||||
// const fetcher: BareFetcher<any> = (url: string) => {
|
||||
// return axios.get(getUrl(url)).then((res) => res.data);
|
||||
// };
|
||||
|
||||
export default function useCachedResources(): IReturnProps {
|
||||
const ip = process.env.NEXT_PUBLIC_INTERNAL_IP;
|
||||
const domain = process.env.NEXT_PUBLIC_DOMAIN;
|
||||
const port = process.env.NEXT_PUBLIC_PORT;
|
||||
|
||||
// const { data } = useSWR<{ ip: string; domain: string; port: string }>('api/ip', fetcher);
|
||||
const { baseUrl, setBaseUrl, setInternalIp, setDomain } = useSytemStore();
|
||||
const [isLoadingComplete, setLoadingComplete] = useState(false);
|
||||
const [client, setClient] = useState<ApolloClient<unknown>>();
|
||||
|
@ -50,7 +45,7 @@ export default function useCachedResources(): IReturnProps {
|
|||
setBaseUrl(`https://${domain}/api`);
|
||||
}
|
||||
}
|
||||
}, [baseUrl, setBaseUrl, setInternalIp, setDomain]);
|
||||
}, [baseUrl, setBaseUrl, setInternalIp, setDomain, ip, domain, port]);
|
||||
|
||||
useEffect(() => {
|
||||
if (baseUrl) {
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
export default function ip(_: any, res: any) {
|
||||
const { INTERNAL_IP } = process.env;
|
||||
const { NGINX_PORT } = process.env;
|
||||
const { DOMAIN } = process.env;
|
||||
|
||||
res.status(200).json({ ip: INTERNAL_IP, domain: DOMAIN, port: NGINX_PORT });
|
||||
}
|
|
@ -5,18 +5,17 @@
|
|||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
|
||||
# use greadlink instead of readlink on osx
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
readlink=greadlink
|
||||
else
|
||||
readlink=readlink
|
||||
fi
|
||||
|
||||
NGINX_PORT=80
|
||||
NGINX_PORT_SSL=443
|
||||
PROXY_PORT=8080
|
||||
DOMAIN=tipi.localhost
|
||||
|
||||
# Check we are on linux
|
||||
if [[ "$(uname)" != "Linux" ]]; then
|
||||
echo "Tipi only works on Linux"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}' | uniq)"
|
||||
INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)"
|
||||
|
||||
|
@ -94,12 +93,6 @@ if [[ $(basename $(pwd)) != "runtipi" ]] || [[ ! -f "${BASH_SOURCE[0]}" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Check we are on linux
|
||||
if [[ "$(uname)" != "Linux" ]]; then
|
||||
echo "Tipi only works on Linux"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If port is not 80 and domain is not tipi.localhost, we exit
|
||||
if [[ "${NGINX_PORT}" != "80" ]] && [[ "${DOMAIN}" != "tipi.localhost" ]]; then
|
||||
echo "Using a custom domain with a custom port is not supported"
|
||||
|
|
|
@ -26,10 +26,8 @@ fi
|
|||
|
||||
# Update Tipi
|
||||
if [[ "$command" = "update" ]]; then
|
||||
|
||||
scripts/stop.sh
|
||||
git pull origin master
|
||||
scripts/start.sh
|
||||
|
||||
exit
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue