Skip to content

Commit

Permalink
fixed weburl beign undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-Roberts123 committed Apr 26, 2024
1 parent c76416f commit 74d2ca6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/CancelBtn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CancelBtn = () => (
type="button"
className="bg-gray-400 hover:bg-gray-600 text-black font-bold py-2 px-4 rounded"
>
<Link to="/">
<Link href="/">
<div>
Cancel
<span className="inline-block" style={{ height: '0.85em' }}>
Expand Down
2 changes: 1 addition & 1 deletion components/Client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Client = ({ id, name, email, phone, address, company, notes }) => {
name={`edit ${name}`}
className="bg-orange-500 hover:bg-orange-700 text-white font-bold py-2 px-4 rounded"
>
<Link to="/edit/[id]" as={`/edit/${id}`}>
<Link href="/edit/[id]" as={`/edit/${id}`}>
<FaRegEdit />
</Link>
</button>
Expand Down
4 changes: 2 additions & 2 deletions components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const Header = () => (
<nav className="flex justify-between">
{useRouter().pathname !== '/' && (
<li className="self-center text-2xl hover:text-gray-500">
<Link to="/">Clients</Link>
<Link href="/">Clients</Link>
</li>
)}
{useRouter().pathname !== '/add-client' && (
<li className="self-center text-2xl hover:text-gray-500 ml-5">
<Link to="/add-client">Add Client</Link>
<Link href="/add-client">Add Client</Link>
</li>
)}
</nav>
Expand Down
3 changes: 2 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require('dotenv').config()
module.exports = {
env: {
username: process.env.USERNAME,
mongodb: process.env.MONGODB_URI
mongodb: process.env.MONGODB_URI,
weburl: process.env.WEBURL
}
}
2 changes: 1 addition & 1 deletion pages/edit/[id].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const Edit = ({ data }) => {

Edit.getInitialProps = async function (context) {
const { id } = context.query
const res = await fetch(`${process.env.WEBURL}/api/get-client?id=${id}`)
const res = await fetch(`${process.env.weburl}/api/get-client?id=${id}`)
const data = await res.json()

return { data: data.user }
Expand Down
4 changes: 2 additions & 2 deletions pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Home = ({ clients }) => (
</tbody>
</table>
<div className="text-center p-5">
<Link to="/add-client">
<Link href="/add-client">
<button className="bg-green-700 hover:bg-green-900 text-white font-bold py-2 px-4 rounded text-2xl">
<div>
Add{' '}
Expand All @@ -41,7 +41,7 @@ const Home = ({ clients }) => (
)

Home.getInitialProps = async function () {
const res = await fetch(`${process.env.WEBURL}/api/clients`)
const res = await fetch(`${process.env.weburl}/api/clients`)
const data = await res.json()

return {
Expand Down

0 comments on commit 74d2ca6

Please sign in to comment.