Skip to content

Commit

Permalink
Updated PHP Config for API Calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
teevans committed Aug 4, 2022
1 parent 33300b8 commit 5aee3f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
10 changes: 9 additions & 1 deletion nginx/pispotter.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
location ^~ /pispotter {
alias /var/www/pispotter;
try_files $uri $uri/ /pispotter/index.html;
try_files $uri $uri/ /pispotter/index.html;

location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;

}
}
24 changes: 16 additions & 8 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { React, Fragment, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { HomeIcon, MenuAlt2Icon, XIcon } from "@heroicons/react/outline";
import {
HomeIcon,
MenuAlt2Icon,
SearchIcon,
XIcon,
} from "@heroicons/react/outline";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Spotter from "./pages/spotter";
import { ApiProvider } from "./contexts/ApiContext";
Expand All @@ -13,6 +18,12 @@ function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}

const defaultURL = () => {
if (!process.env.NODE_ENV || process.env.NODE_ENV === "development")
return "http://192.168.1.184";
return "";
};

const App = () => {
const [sidebarOpen, setSidebarOpen] = useState(false);

Expand All @@ -21,7 +32,7 @@ const App = () => {

return (
<>
<ApiProvider value={""}>
<ApiProvider value={defaultURL()}>
<div>
<Transition.Root show={sidebarOpen} as={Fragment}>
<Dialog
Expand Down Expand Up @@ -122,12 +133,9 @@ const App = () => {
<div className="hidden md:flex md:w-64 md:flex-col md:fixed md:inset-y-0">
{/* Sidebar component, swap this element with another sidebar if you like */}
<div className="flex-1 flex flex-col min-h-0 bg-gray-800">
<div className="flex items-center h-16 flex-shrink-0 px-4 bg-gray-900">
<img
className="h-8 w-auto"
src="https://tailwindui.com/img/logos/workflow-logo-indigo-500-mark-white-text.svg"
alt="Blah."
/>
<div className="flex text-white items-center h-16 flex-shrink-0 px-4 bg-gray-900">
<SearchIcon class="h-6 mr-2" />
<span className="font-bold text-2xl">Pi-Spotter</span>
</div>
<div className="flex-1 flex flex-col overflow-y-auto">
<nav className="flex-1 px-2 py-4 space-y-1">
Expand Down

0 comments on commit 5aee3f3

Please sign in to comment.