Skip to content

Commit

Permalink
re-added user role property
Browse files Browse the repository at this point in the history
  • Loading branch information
carnasci committed Apr 23, 2024
1 parent 2085d3b commit d1518c5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion ReactFrontEnd/src/Services/ReviewServices.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,25 @@ import { getItem } from 'localforage';

const REVIEW_API_BASE_URL = "http://localhost:8080/api/v1/review";

const axiosInstance = axios.create({
withCredentials: true,
baseURL: REVIEW_API_BASE_URL,
headers: {
"Cache-Control": "no-cache",
"Accept-Language": "en",
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "http://localhost:5173",
"Access-Control-Allow-Methods": "POST",
"Access-Control-Allow-Headers":
"Content-Type, Authorization, X-Requested-With",
Authorization: window.localStorage.getItem("Auth"),
},
});

class ReviewService {
createReview(review) {
return axios.post(REVIEW_API_BASE_URL, review);
console.log(window.localStorage.getItem("Auth"));
return axiosInstance.post(REVIEW_API_BASE_URL, review);
}

getReviewsByUserId(id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public class User {
private List<com.nationalParkApp.demo.Model.Itinerary> itineraries;
private List<com.nationalParkApp.demo.Model.Review> reviews;
private List<com.nationalParkApp.demo.Model.Favorites> favorites;
private String role = "user";

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.nationalParkApp.demo.Repository;

import com.nationalParkApp.demo.Model.User;
import com.nationalParkApp.demo.entity.FavoritesEntity;
import com.nationalParkApp.demo.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends JpaRepository<UserEntity, Long> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public class UserEntity {
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
private List<FavoritesEntity> favorites;

private String role = "role";

}

0 comments on commit d1518c5

Please sign in to comment.