Skip to content
Snippets Groups Projects
Commit 10a1d648 authored by Miriam Lang's avatar Miriam Lang
Browse files

btmbuch

parent 415987d9
No related branches found
No related tags found
No related merge requests found
REACT_APP_BACKEND_URL=http://localhost:8080
REACT_APP_BACKEND_URL=localhost:8080
This diff is collapsed.
......@@ -6,8 +6,7 @@ export default function ApothekeBtmList(props) {
const [btms, setBtms] = useState([]);
const getBtms = async () => {
const response = await fetch(
`http://${process.env.REACT_APP_BACKEND_HOSTNAME}/apotheke/${props.match.params.id}/btmbuchung`,
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_URL}/apotheke/${props.match.params.id}/btmbuchung`,
{
method: "GET",
headers: {
......@@ -21,9 +20,8 @@ export default function ApothekeBtmList(props) {
});
if (response.status === 200) {
console.log('response: ' , response);
setBtms(await JSON.stringify(btms));
// console.log('btms >>> nr. 1' + btms[0].buchungen);
console.log('btms >>> nr. 1' + btms[0].buchungen);
// console.log(JSON.stringify(btms));
} else if (response.status === 403) {
props.history.push("/forbidden");
......
......
......@@ -8,7 +8,7 @@ function ApothekenDetails(props) {
const getApothekeData = async () => {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_HOSTNAME}/apotheke/${props.match.params.id}`, {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_URL}/apotheke/${props.match.params.id}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + window.sessionStorage.getItem("edbapo-jwt"),
......
......
......@@ -15,7 +15,7 @@ function BTMBuch (props) {
const [aktiveRolle, setAktiveRolle] = useState('');
const getUserDetails = async event => {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_HOSTNAME}/benutzer/me`, {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_URL}/benutzer/me`, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + window.sessionStorage.getItem("edbapo-jwt"),
......@@ -27,6 +27,7 @@ function BTMBuch (props) {
if(response.status === 200) {
let u = await response.json();
console.log(JSON.stringify(u))
setUser(u);
setAktiveRolle(u.rolle);
setLoggedIn(true);
......@@ -52,7 +53,7 @@ function BTMBuch (props) {
<Col><ApothekenDetails {...props} apothekeRefFunctions={apothekeRefFunctions} apothekeId={apothekeId}/></Col>
<Col>{isLoggedIn ? <UserDetails {...props} user={user} aktiveRolle={aktiveRolle} setAktiveRolle={setAktiveRolle}/> : null }</Col>
</Row>
<ApothekeBtmList apothekeId={apothekeId} user={user} apothekeRefFunctions={apothekeRefFunctions} {...props}/>
</React.Fragment>
)
}
......
......
......@@ -9,7 +9,7 @@ function Login(props) {
const [user, setUser] = useState({username:'', password:''});
const login = async event => {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_HOSTNAME}/login`, {
const response = await fetch(`http://${process.env.REACT_APP_BACKEND_URL}/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment