Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
6ff6610f
Commit
6ff6610f
authored
4 years ago
by
Lucas Eduardo Schoenfelder
Browse files
Options
Downloads
Patches
Plain Diff
fix api call
parent
e721247c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!40
merge admin into develop
,
!37
Merge sistema_admin into Update_Admin_System
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Admin/Components/Components/Inputs/IntitutionsInputs.js
+13
-10
13 additions, 10 deletions
src/Admin/Components/Components/Inputs/IntitutionsInputs.js
with
13 additions
and
10 deletions
src/Admin/Components/Components/Inputs/IntitutionsInputs.js
+
13
−
10
View file @
6ff6610f
...
@@ -21,7 +21,9 @@ import TextField from '@material-ui/core/TextField';
...
@@ -21,7 +21,9 @@ import TextField from '@material-ui/core/TextField';
import
Button
from
"
@material-ui/core/Button
"
;
import
Button
from
"
@material-ui/core/Button
"
;
import
SaveIcon
from
"
@material-ui/icons/Save
"
;
import
SaveIcon
from
"
@material-ui/icons/Save
"
;
import
{
Store
}
from
'
../../../../Store
'
;
import
{
Store
}
from
'
../../../../Store
'
;
// import { apiUrl } from '../../../../env';
import
{
apiUrl
}
from
'
../../../../env
'
;
import
axios
from
'
axios
'
import
{
getAxiosConfig
}
from
'
../../../../Components/HelperFunctions/getAxiosConfig
'
const
InstitutionsInputs
=
(
props
)
=>
{
const
InstitutionsInputs
=
(
props
)
=>
{
...
@@ -31,9 +33,10 @@ const InstitutionsInputs = (props) => {
...
@@ -31,9 +33,10 @@ const InstitutionsInputs = (props) => {
const
[
adress
,
setAdress
]
=
useState
(
props
.
editInfo
.
adress
)
const
[
adress
,
setAdress
]
=
useState
(
props
.
editInfo
.
adress
)
const
[
city
,
setCity
]
=
useState
(
props
.
editInfo
.
city
)
const
[
city
,
setCity
]
=
useState
(
props
.
editInfo
.
city
)
const
[
country
,
setCountry
]
=
useState
(
props
.
editInfo
.
country
)
const
[
country
,
setCountry
]
=
useState
(
props
.
editInfo
.
country
)
const
api
=
'
https://api.portalmec
test
.c3sl.ufpr.br/v1/institutions
'
;
//Api
const
api
=
'
https://api.portalmec.c3sl.ufpr.br/v1/institutions
'
;
//Api
const
SubmitHandler
=
()
=>
{
const
SubmitHandler
=
(
e
)
=>
{
e
.
preventDefault
()
fetch
(
api
+
'
/
'
+
props
.
editInfo
.
id
,
{
fetch
(
api
+
'
/
'
+
props
.
editInfo
.
id
,
{
method
:
'
PUT
'
,
method
:
'
PUT
'
,
headers
:
{
headers
:
{
...
@@ -41,16 +44,16 @@ const InstitutionsInputs = (props) => {
...
@@ -41,16 +44,16 @@ const InstitutionsInputs = (props) => {
'
Content-Type
'
:
'
application/json; charset=utf-8
'
,
'
Content-Type
'
:
'
application/json; charset=utf-8
'
,
'
access-token
'
:
sessionStorage
.
getItem
(
'
@portalmec/accessToken
'
),
'
access-token
'
:
sessionStorage
.
getItem
(
'
@portalmec/accessToken
'
),
'
client
'
:
sessionStorage
.
getItem
(
'
@portalmec/clientToken
'
),
'
client
'
:
sessionStorage
.
getItem
(
'
@portalmec/clientToken
'
),
'
uid
'
:
sessionStorage
.
getItem
(
'
@portalmec/uid
'
),
'
uid
'
:
sessionStorage
.
getItem
(
'
@portalmec/uid
'
),
'
If-None-Match
'
:
null
'
If-None-Match
'
:
null
},
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
"
institution
"
:
{
'
name
'
:
name
,
'
name
'
:
name
,
'
description
'
:
''
,
'
description
'
:
''
,
'
address
'
:
adress
,
'
address
'
:
adress
,
'
city
'
:
city
,
'
city
'
:
city
,
'
country
'
:
country
,
'
country
'
:
country
,
})
}
})
}).
then
(
response
=>
{
}).
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
console
.
log
(
'
ok
'
)
console
.
log
(
'
ok
'
)
...
@@ -63,13 +66,13 @@ const InstitutionsInputs = (props) => {
...
@@ -63,13 +66,13 @@ const InstitutionsInputs = (props) => {
console
.
log
(
api
+
'
/
'
+
props
.
editInfo
.
id
);
console
.
log
(
api
+
'
/
'
+
props
.
editInfo
.
id
);
return
(
return
(
<
form
style
=
{{
width
:
'
25%
'
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
}}
>
<
form
style
=
{{
width
:
'
25%
'
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
}}
onSubmit
=
{
SubmitHandler
}
>
<
TextField
<
TextField
id
=
"
outlined-input
"
id
=
"
outlined-input
"
label
=
"
ID *não pode mudar
"
label
=
"
ID *não pode mudar
"
defaultValue
=
{
props
.
editInfo
.
id
}
//valor recebido por prop
defaultValue
=
{
props
.
editInfo
.
id
}
//valor recebido por prop
variant
=
"
outlined
"
variant
=
"
outlined
"
disabled
=
{
true
}
disabled
=
{
true
}
/
>
/
>
<
div
style
=
{{
height
:
'
1em
'
}}
/
>
<
div
style
=
{{
height
:
'
1em
'
}}
/
>
...
@@ -108,7 +111,7 @@ const InstitutionsInputs = (props) => {
...
@@ -108,7 +111,7 @@ const InstitutionsInputs = (props) => {
variant
=
"
outlined
"
variant
=
"
outlined
"
/>
/>
<
div
style
=
{{
height
:
'
1em
'
}}
/
>
<
div
style
=
{{
height
:
'
1em
'
}}
/
>
<
Button
size
=
"
small
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
}}
onClick
=
{
SubmitHandler
}
>
<
Button
size
=
"
small
"
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
flex-start
'
,
alignItems
:
'
center
'
}}
type
=
"
submit
"
>
<
SaveIcon
style
=
{{
fill
:
"
#6959CD
"
}}
/
>
<
SaveIcon
style
=
{{
fill
:
"
#6959CD
"
}}
/
>
Salvar
Salvar
<
/Button
>
<
/Button
>
...
@@ -116,4 +119,4 @@ const InstitutionsInputs = (props) => {
...
@@ -116,4 +119,4 @@ const InstitutionsInputs = (props) => {
)
)
}
}
export
default
InstitutionsInputs
;
export
default
InstitutionsInputs
;
\ No newline at end of file
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