Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EDB-Apo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Adrian Christian Beilharz
EDB-Apo
Commits
ad14c23c
Commit
ad14c23c
authored
Jan 7, 2021
by
AdrianBeilharz
Browse files
Options
Downloads
Patches
Plain Diff
fix react errors for btmbuch
parent
b362d6a4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/components/apotheke/ApothekeBtmList.js
+16
-15
16 additions, 15 deletions
frontend/src/components/apotheke/ApothekeBtmList.js
frontend/src/components/btmbuch/BTMBuch.js
+38
-38
38 additions, 38 deletions
frontend/src/components/btmbuch/BTMBuch.js
with
54 additions
and
53 deletions
frontend/src/components/apotheke/ApothekeBtmList.js
+
16
−
15
View file @
ad14c23c
...
@@ -8,8 +8,8 @@ function ApothekeBtmList(props) {
...
@@ -8,8 +8,8 @@ function ApothekeBtmList(props) {
const
[
btms
,
setBtms
]
=
useState
([]);
const
[
btms
,
setBtms
]
=
useState
([]);
const
[
input
,
setInput
]
=
useState
(
""
);
const
[
input
,
setInput
]
=
useState
(
""
);
const
getBtms
=
async
()
=>
{
const
getBtms
=
()
=>
{
const
response
=
await
fetch
(
fetch
(
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/apotheke/
${
apoId
}
/btmbuchung`
,
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/apotheke/
${
apoId
}
/btmbuchung`
,
{
{
method
:
"
GET
"
,
method
:
"
GET
"
,
...
@@ -18,26 +18,26 @@ function ApothekeBtmList(props) {
...
@@ -18,26 +18,26 @@ function ApothekeBtmList(props) {
"
Bearer
"
+
window
.
sessionStorage
.
getItem
(
"
edbapo-jwt
"
),
"
Bearer
"
+
window
.
sessionStorage
.
getItem
(
"
edbapo-jwt
"
),
},
},
}
}
).
catch
((
err
)
=>
{
).
then
(
response
=>
{
//SHOW ERROR
return
;
});
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
setBtms
(
await
response
.
json
()
);
return
response
.
json
()
}
else
if
(
response
.
status
===
403
)
{
}
else
if
(
response
.
status
===
403
)
{
props
.
history
.
push
(
"
/forbidden
"
);
props
.
history
.
push
(
"
/forbidden
"
);
}
else
if
(
response
.
status
===
400
)
{
}
else
if
(
response
.
status
===
400
)
{
props
.
history
.
push
(
"
/badrequest
"
);
props
.
history
.
push
(
"
/badrequest
"
);
}
}
}).
then
(
data
=>
setBtms
(
data
)).
catch
((
err
)
=>
{
//SHOW ERROR
return
;
});
};
};
//wird aufgerufen von NeuesBtmModal wenn ein neues BTM hinzugefügt wurde
//wird aufgerufen von NeuesBtmModal wenn ein neues BTM hinzugefügt wurde
props
.
apothekeRefFunctions
.
updateBtmList
=
getBtms
;
props
.
apothekeRefFunctions
.
updateBtmList
=
getBtms
;
useEffect
(()
=>
{
useEffect
(
getBtms
,
[
apoId
,
props
.
history
]);
getBtms
();
},
[]);
return
(
return
(
<
div
className
=
"
btm-buchung-wrapper
"
>
<
div
className
=
"
btm-buchung-wrapper
"
>
...
@@ -57,9 +57,10 @@ function ApothekeBtmList(props) {
...
@@ -57,9 +57,10 @@ function ApothekeBtmList(props) {
}
else
if
(
val
.
btm
.
name
.
toLowerCase
().
includes
(
input
.
toLowerCase
())){
}
else
if
(
val
.
btm
.
name
.
toLowerCase
().
includes
(
input
.
toLowerCase
())){
return
val
;
return
val
;
}
}
return
null
;
})
})
.
map
((
btm
,
key
)
=>
(
.
map
((
btm
)
=>
(
<
BuchungTabelle
{...
props
}
btm
=
{
btm
}
/>
<
BuchungTabelle
{...
props
}
key
=
{
btm
.
id
}
btm
=
{
btm
}
/>
))}
))}
<
/div>
<
/div>
);
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/btmbuch/BTMBuch.js
+
38
−
38
View file @
ad14c23c
...
@@ -15,33 +15,33 @@ function BTMBuch (props) {
...
@@ -15,33 +15,33 @@ function BTMBuch (props) {
const
[
isLoggedIn
,
setLoggedIn
]
=
useState
(
false
);
const
[
isLoggedIn
,
setLoggedIn
]
=
useState
(
false
);
const
[
aktiveRolle
,
setAktiveRolle
]
=
useState
(
''
);
const
[
aktiveRolle
,
setAktiveRolle
]
=
useState
(
''
);
const
getUserDetails
=
async
event
=>
{
const
getUserDetails
=
event
=>
{
const
response
=
await
fetch
(
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/benutzer/me`
,
{
fetch
(
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/benutzer/me`
,
{
method
:
'
GET
'
,
method
:
'
GET
'
,
headers
:
{
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
window
.
sessionStorage
.
getItem
(
"
edbapo-jwt
"
),
'
Authorization
'
:
'
Bearer
'
+
window
.
sessionStorage
.
getItem
(
"
edbapo-jwt
"
),
}
}
}).
catch
((
err
)
=>
{
}).
then
(
response
=>
{
//SHOW ERROR
return
;
});
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
let
u
=
await
response
.
json
();
return
response
.
json
();
console
.
log
(
JSON
.
stringify
(
u
))
setUser
(
u
);
setAktiveRolle
(
u
.
rolle
);
setLoggedIn
(
true
);
}
else
if
(
response
.
status
===
403
)
{
}
else
if
(
response
.
status
===
403
)
{
props
.
history
.
push
(
'
/forbidden
'
);
props
.
history
.
push
(
'
/forbidden
'
);
}
else
if
(
response
.
status
===
400
)
{
}
else
if
(
response
.
status
===
400
)
{
props
.
history
.
push
(
'
/badrequest
'
);
props
.
history
.
push
(
'
/badrequest
'
);
}
}
}).
then
(
data
=>
{
setUser
(
data
);
setAktiveRolle
(
data
.
rolle
);
setLoggedIn
(
true
);
}).
catch
((
err
)
=>
{
//SHOW ERROR
return
;
});
}
}
useEffect
(()
=>
{
useEffect
(
getUserDetails
,
[
apoId
,
props
.
history
])
getUserDetails
();
},
[])
//this obj is passed to each child, each child can add functions to this object and call functions from this object
//this obj is passed to each child, each child can add functions to this object and call functions from this object
let
apothekeRefFunctions
=
{}
let
apothekeRefFunctions
=
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment