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
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
Merge requests
!30
Centraliza axios
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Centraliza axios
centraliza-axios
into
Fix_Console_Error
Overview
0
Commits
19
Pipelines
0
Changes
98
Merged
Lucas Eduardo Schoenfelder
requested to merge
centraliza-axios
into
Fix_Console_Error
4 years ago
Overview
0
Commits
19
Pipelines
0
Changes
98
Expand
0
0
Merge request reports
Compare
Fix_Console_Error
Fix_Console_Error (base)
and
latest version
latest version
1a71df8b
19 commits,
4 years ago
98 files
+
1495
−
2492
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
98
Search (e.g. *.vue) (Ctrl+P)
src/Components/ContactButtons/FollowButton.js
+
12
−
40
Options
@@ -20,32 +20,19 @@ import React from 'react'
import
PersonAddIcon
from
'
@material-ui/icons/PersonAdd
'
;
import
styled
from
'
styled-components
'
import
Button
from
'
@material-ui/core/Button
'
;
import
axios
from
'
axios
'
import
{
apiUrl
}
from
'
../../env
'
;
import
{
getAxiosConfig
}
from
'
../HelperFunctions/getAxiosConfig
'
import
{
putRequest
}
from
'
../HelperFunctions/getAxiosConfig
'
export
default
function
FollowButton
(
props
)
{
const
handleFollow
=
(
followerID
)
=>
{
const
id
=
followerID
console
.
log
(
'
id:
'
,
id
)
let
payload
=
{}
const
header
=
getAxiosConfig
()
axios
.
put
((
`
${
apiUrl
}
/users/`
+
id
+
'
/follow
'
),
payload
,
header
).
then
(
(
response
)
=>
{
if
(
response
.
headers
[
'
access-token
'
]
)
{
sessionStorage
.
setItem
(
'
@portalmec/accessToken
'
,
response
.
headers
[
'
access-token
'
])
}
console
.
log
(
response
)
props
.
toggleFollowed
()
},
(
error
)
=>
{
console
.
log
(
error
)
}
)
function
handleSuccess
(
data
)
{
props
.
toggleFollowed
()
}
const
handleFollow
=
(
followerID
)
=>
{
if
(
followerID
!==
undefined
)
{
const
url
=
`/users/
${
followerID
}
/follow/`
putRequest
(
url
,
{},
handleSuccess
,
(
error
)
=>
{
console
.
log
(
error
)})
}
}
return
(
@@ -62,24 +49,9 @@ export default function FollowButton (props) {
export
function
NoIcon
(
props
)
{
const
handleFollow
=
(
followerID
)
=>
{
const
id
=
followerID
console
.
log
(
'
id:
'
,
id
)
if
(
id
!==
undefined
)
{
let
payload
=
{}
const
header
=
getAxiosConfig
()
axios
.
put
((
`
${
apiUrl
}
/users/`
+
id
+
'
/follow
'
),
payload
,
header
).
then
(
(
response
)
=>
{
if
(
response
.
headers
[
'
access-token
'
]
)
{
sessionStorage
.
setItem
(
'
@portalmec/accessToken
'
,
response
.
headers
[
'
access-token
'
])
}
console
.
log
(
response
)
},
(
error
)
=>
{
console
.
log
(
error
)
}
)
if
(
followerID
!==
undefined
)
{
const
url
=
`/users/
${
followerID
}
/follow/`
putRequest
(
url
,
{},
(
data
)
=>
{
console
.
log
(
data
)},
(
error
)
=>
{
console
.
log
(
error
)})
}
}
Loading