-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
110 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,5 @@ public User getUserFromSession(HttpSession session) { | |
return userOpt.get(); | ||
} | ||
|
||
//@GetMapping("/register") | ||
|
||
|
||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/unit3project/demo/Controllers/api/AuthApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.unit3project.demo.Controllers.api; | ||
|
||
import com.unit3project.demo.Controllers.AuthController; | ||
import com.unit3project.demo.Models.DTO.LogInDTO; | ||
import com.unit3project.demo.Models.Data.UserRepository; | ||
import com.unit3project.demo.Models.User; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@CrossOrigin//(origins = "http://localhost:5173", maxAge = 3600) | ||
@RestController | ||
@RequestMapping("/api") | ||
public class AuthApiController extends AuthController { | ||
|
||
|
||
|
||
@Autowired | ||
UserRepository userRepository; | ||
|
||
@GetMapping("/user") | ||
//@ResponseStatus(value= HttpStatus.OK) | ||
public List<User> printUser(@RequestParam("username") String username, @RequestParam("password") String password) { | ||
List<User> testList = new ArrayList<>(); | ||
LogInDTO testForm = new LogInDTO(); | ||
testForm.setUsername(username); | ||
testForm.setPassword(password); | ||
User testUser = new User(testForm.getUsername(), testForm.getPassword()); | ||
User testUser2 = new User("karl","654321"); | ||
testUser.setName("Eric"); | ||
testUser2.setName("Karl"); | ||
testList.add(testUser); | ||
testList.add(testUser2); | ||
userRepository.save(testUser); | ||
userRepository.save((testUser2)); | ||
return testList; | ||
} | ||
|
||
/*@PostMapping("/user") | ||
public @ResponseBody String setUser() { | ||
User testUser =new User("eric", "123456"); | ||
return testUser.toString(); | ||
}*/ | ||
|
||
} |
25 changes: 0 additions & 25 deletions
25
src/main/java/com/unit3project/demo/Controllers/api/authApiController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
public class Itinerary extends Park{ | ||
public class Itinerary extends AbstractEntity{ | ||
//properties, getters/setters, how many itineraries can each user have? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/unit3project/demo/WebApplicationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.unit3project.demo; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
/*@Configuration | ||
public class WebApplicationConfig implements WebMvcConfigurer { | ||
@Bean | ||
public AuthenticationFilter authenticationFilter() { | ||
return new AuthenticationFilter(); | ||
} | ||
@Override | ||
public void addInterceptors(InterceptorRegistry registry){ | ||
registry.addInterceptor(authenticationFilter()); | ||
} | ||
}*/ |
42 changes: 0 additions & 42 deletions
42
src/main/resources/static/js/national-park-app/src/App.css
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/resources/static/js/national-park-app/src/App.jsx
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/main/resources/static/js/national-park-app/src/assets/components/LogInForm.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
src/main/resources/static/js/national-park-app/src/main.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.jsx' | ||
import './index.css' | ||
import Root from "./routes/root" | ||
import { createBrowserRouter, RouterProvider } from 'react-router-dom' | ||
import Fetch from './assets/components/Fetch' | ||
import LogInForm from "./assets/components/LogInForm" | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Fetch/>, | ||
} | ||
]); | ||
|
||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
<React.StrictMode> | ||
<App /> | ||
<Root/>//placement for navbar/header element | ||
<RouterProvider router={router} />// uses the url path to direct router to react components | ||
</React.StrictMode>, | ||
) |
13 changes: 13 additions & 0 deletions
13
src/main/resources/static/js/national-park-app/src/routes/root.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react' | ||
import Fetch from "../assets/components/Fetch" | ||
|
||
const Root = () => { | ||
return ( | ||
<> | ||
<div> | ||
<h2>Header and navBar</h2> | ||
</div> | ||
</> | ||
) | ||
} | ||
export default Root; |