remove JSON.stringify from authorization tokens
This commit is contained in:
parent
6d7f56fe58
commit
cdd8037d5f
@ -34,10 +34,7 @@ const EditSystem = ({
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: JSON.stringify(localStorage.getItem("token")).slice(
|
Authorization: localStorage.getItem("token"),
|
||||||
1,
|
|
||||||
-1
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
|
@ -21,10 +21,7 @@ const EditSystemPrivacy = ({
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: JSON.stringify(localStorage.getItem("token")).slice(
|
Authorization: localStorage.getItem("token"),
|
||||||
1,
|
|
||||||
-1
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
|
@ -125,7 +125,7 @@ export default function MemberCard(props) {
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
@ -146,7 +146,7 @@ export default function MemberCard(props) {
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
@ -166,7 +166,7 @@ export default function MemberCard(props) {
|
|||||||
fetch(`${API_URL}m/${member.id}`,{
|
fetch(`${API_URL}m/${member.id}`,{
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (() => {
|
}}).then (() => {
|
||||||
setErrorAlert(false);
|
setErrorAlert(false);
|
||||||
setMemberDeleted(true);
|
setMemberDeleted(true);
|
||||||
@ -197,7 +197,7 @@ export default function MemberCard(props) {
|
|||||||
body: JSON.stringify(newdata),
|
body: JSON.stringify(newdata),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
|
@ -126,7 +126,7 @@ export default function MemberPage(props) {
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
@ -147,7 +147,7 @@ export default function MemberPage(props) {
|
|||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
@ -167,7 +167,7 @@ export default function MemberPage(props) {
|
|||||||
fetch(`${API_URL}m/${member.id}`,{
|
fetch(`${API_URL}m/${member.id}`,{
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (() => {
|
}}).then (() => {
|
||||||
setErrorAlert(false);
|
setErrorAlert(false);
|
||||||
setMemberDeleted(true);
|
setMemberDeleted(true);
|
||||||
@ -198,7 +198,7 @@ export default function MemberPage(props) {
|
|||||||
body: JSON.stringify(newdata),
|
body: JSON.stringify(newdata),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMember(prevState => {return {...prevState, ...data}});
|
setMember(prevState => {return {...prevState, ...data}});
|
||||||
|
@ -53,7 +53,7 @@ export default function Memberlist() {
|
|||||||
fetch(`${API_URL}s/${userId}/members`,{
|
fetch(`${API_URL}s/${userId}/members`,{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then ( res => res.json()
|
}}).then ( res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setMembers(data)
|
setMembers(data)
|
||||||
@ -169,7 +169,7 @@ export default function Memberlist() {
|
|||||||
body: JSON.stringify(newdata),
|
body: JSON.stringify(newdata),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then (res => res.json()
|
}}).then (res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
setErrorAlert(false);
|
setErrorAlert(false);
|
||||||
|
@ -28,10 +28,7 @@ const { register, handleSubmit } = useForm();
|
|||||||
fetch(`${API_URL}s/`, {
|
fetch(`${API_URL}s/`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: JSON.stringify(localStorage.getItem("token")).slice(
|
Authorization: localStorage.getItem("token"),
|
||||||
1,
|
|
||||||
-1
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// put all the system data in localstorage
|
// put all the system data in localstorage
|
||||||
@ -72,7 +69,7 @@ const { register, handleSubmit } = useForm();
|
|||||||
fetch(`${API_URL}s/`,{
|
fetch(`${API_URL}s/`,{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
|
'Authorization': localStorage.getItem("token")
|
||||||
}}).then ( res => res.json()
|
}}).then ( res => res.json()
|
||||||
).then (data => {
|
).then (data => {
|
||||||
localStorage.setItem('user', JSON.stringify(data));
|
localStorage.setItem('user', JSON.stringify(data));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user