Skip to content

Commit 82aea64

Browse files
authored
remove stray import when no-auth is choosen (#32)
1 parent 9dd8bc1 commit 82aea64

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

templates/src/components/Navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext } from 'react'
1+
import React<%if eq (index .Params `userAuth`) "yes" %>, { useContext }<% end %> from 'react'
22
import { Link } from 'react-router-dom'
33
<%if eq (index .Params `userAuth`) "yes" %> import { AuthContext } from '../context/AuthContext' <% end %>
44
import logo from '../commit-logo.png'

templates/src/pages/Dashboard.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React, { useContext, useEffect, useState } from 'react'
1+
import React, { <%if eq (index .Params `userAuth`) "yes" %>useContext, <% end %>useEffect, useState } from 'react'
22
33
import Card from '../components/Card'
44
<%if eq (index .Params `userAuth`) "yes" %> import { AuthContext } from '../context/AuthContext'
5-
import AuthCheck from '../components/AuthCheck'<% end %>
6-
5+
import AuthCheck from '../components/AuthCheck'
6+
<% end %>
77
88
// This is an example of an authenticated only page
99
// to showcase how you would implement a page that loads data from backend
@@ -17,8 +17,7 @@ const fetchDashboard = async(data) => new Promise((resolve) => {
1717
setTimeout(fakeFetchData, 500);
1818
})
1919
20-
<%if eq (index .Params `userAuth`) "yes" %>
21-
function Dashboard() {
20+
<%if eq (index .Params `userAuth`) "yes" %>function Dashboard() {
2221
const { state: authState } = useContext(AuthContext)
2322
const [state, setState] = useState({
2423
isLoading: true,
@@ -56,8 +55,7 @@ function Dashboard() {
5655
</AuthCheck>
5756
)
5857
}
59-
<% else if eq (index .Params `userAuth`) "no" %>
60-
function Dashboard () {
58+
<% else if eq (index .Params `userAuth`) "no" %>function Dashboard () {
6159
const [state, setState] = useState({
6260
isLoading: true,
6361
data: {},

0 commit comments

Comments
 (0)