Skip to content

Commit

Permalink
Merge pull request #316 from NUS-Project-SaBai/remove-query-onload-debug
Browse files Browse the repository at this point in the history
Remove feature where the debug page auto query on load.
  • Loading branch information
davidgohzk authored Dec 8, 2024
2 parents 568c0fa + 7c498d0 commit d3b8e0c
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions components/debug/APIComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,6 @@ export function APIComponent({ baseURL, path }) {

useEffect(() => {
setUrl(baseURL + path);
// Run initial GET request to check API and set payload
const fetchData = async () => {
try {
const res = await axiosInstance.get(baseURL + path, {
headers: {
'Content-Type': 'application/json',
},
});

setResponse(res.data);

let templateData = res.data;

if (Array.isArray(res.data) && res.data.length > 0) {
templateData = res.data[0];
}

if (typeof templateData === 'object') {
setPayload(JSON.stringify(templateData, null, 2));
}
} catch (err) {
setError(err.message);
}
};

fetchData();
}, [baseURL, path]);

const handleSubmit = async e => {
Expand Down

0 comments on commit d3b8e0c

Please sign in to comment.