mirror of
https://github.com/codex-storage/codex-frontend.git
synced 2025-03-01 02:30:49 +00:00
Auth header and state changes
Changed conditional for auth header and when the new connection settings are saved.
This commit is contained in:
parent
eb9865ca2b
commit
61a58df706
@ -17,7 +17,7 @@ function DownloadTab() {
|
|||||||
}/api/codex/v1/download/${cid}`,
|
}/api/codex/v1/download/${cid}`,
|
||||||
{
|
{
|
||||||
headers:
|
headers:
|
||||||
(nodeInfo.auth && {
|
(nodeInfo.auth !== null && {
|
||||||
Authorization:
|
Authorization:
|
||||||
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
|
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
|
||||||
}) ||
|
}) ||
|
||||||
|
@ -45,7 +45,7 @@ function UploadTab() {
|
|||||||
try {
|
try {
|
||||||
await axios
|
await axios
|
||||||
.post(`${constants.testApiBaseUrl}/upload`, bytes, {
|
.post(`${constants.testApiBaseUrl}/upload`, bytes, {
|
||||||
headers: (nodeInfo.auth && {
|
headers: (nodeInfo.auth !== null && {
|
||||||
"Base-Url": nodeInfo.nodeToConnectTo || nodeInfo.baseUrl,
|
"Base-Url": nodeInfo.nodeToConnectTo || nodeInfo.baseUrl,
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
"Auth-String": nodeInfo.auth,
|
"Auth-String": nodeInfo.auth,
|
||||||
|
@ -24,7 +24,7 @@ function DebugPage() {
|
|||||||
}/api/codex/v1/debug/info`,
|
}/api/codex/v1/debug/info`,
|
||||||
{
|
{
|
||||||
headers:
|
headers:
|
||||||
(nodeInfo.auth && {
|
(nodeInfo.auth !== null && {
|
||||||
Authorization:
|
Authorization:
|
||||||
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
|
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
|
||||||
}) ||
|
}) ||
|
||||||
|
@ -117,14 +117,6 @@ function SettingsPage() {
|
|||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setNodeInfo({
|
|
||||||
baseUrl: nodeInfoInput.nodeBaseUrl,
|
|
||||||
nodeToConnectTo: nodeInfoInput.nodeToConnectTo,
|
|
||||||
id: nodeInfoInput.nodeId,
|
|
||||||
// ip: nodeInfoInput.nodeIp,
|
|
||||||
address: nodeInfoInput.nodeAddress,
|
|
||||||
auth: nodeInfoInput.auth,
|
|
||||||
});
|
|
||||||
connectOnSave({
|
connectOnSave({
|
||||||
baseUrl: nodeInfoInput.nodeBaseUrl,
|
baseUrl: nodeInfoInput.nodeBaseUrl,
|
||||||
nodeToConnectTo: nodeInfoInput.nodeToConnectTo,
|
nodeToConnectTo: nodeInfoInput.nodeToConnectTo,
|
||||||
@ -132,6 +124,15 @@ function SettingsPage() {
|
|||||||
// ip: nodeInfoInput.nodeIp,
|
// ip: nodeInfoInput.nodeIp,
|
||||||
address: nodeInfoInput.nodeAddress,
|
address: nodeInfoInput.nodeAddress,
|
||||||
auth: nodeInfoInput.auth,
|
auth: nodeInfoInput.auth,
|
||||||
|
}).then(() => {
|
||||||
|
setNodeInfo({
|
||||||
|
baseUrl: nodeInfoInput.nodeBaseUrl,
|
||||||
|
nodeToConnectTo: nodeInfoInput.nodeToConnectTo,
|
||||||
|
id: nodeInfoInput.nodeId,
|
||||||
|
// ip: nodeInfoInput.nodeIp,
|
||||||
|
address: nodeInfoInput.nodeAddress,
|
||||||
|
auth: nodeInfoInput.auth,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user