Skip to content

Commit

Permalink
fix: content type for edit org
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Nov 29, 2023
1 parent a853d4a commit 1ddcf5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/store/actions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ export const signInFromLocalStorage = () => {
const serverAddress = localStorage.getItem('cadtRemoteServerAddress');

if (serverAddress) {
// Ping the server to check if it's reachable and returns a 200 status.
try {
const response = await fetch(`${serverAddress}/v1/organizations`, {
method: 'HEAD',
});
if (response.status !== 200) {
console.error(`Server returned status: ${response.status}`);
localStorage.removeItem('cadtRemoteServerApiKey');
localStorage.removeItem('cadtRemoteServerAddress');
return;
}
} catch (error) {
console.error(`Failed to ping server: ${error.message}`);
localStorage.removeItem('cadtRemoteServerApiKey');
localStorage.removeItem('cadtRemoteServerAddress');
return;
}

let payload = { serverAddress };

if (apiKey) {
Expand Down
3 changes: 0 additions & 3 deletions src/store/actions/climateWarehouseActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1918,9 +1918,6 @@ export const editExistingOrg = data => {
const url = `${constants.API_HOST}/organizations/edit`;
const payload = {
method: 'PUT',
headers: {
'Content-Type': 'multipart/form-data',
},
body: formData,
};

Expand Down

0 comments on commit 1ddcf5c

Please sign in to comment.