Skip to content

Commit

Permalink
fix rsponse not being read
Browse files Browse the repository at this point in the history
  • Loading branch information
RitikJaiswal75 committed Jul 26, 2023
1 parent f356526 commit ada3f6b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getCurrentTimestamp() {

export async function showSuperUserOptions(...privateBtns) {
try {
const isSuperUser = true; //await checkUserIsSuperUser();
await checkUserIsSuperUser();
if (isSuperUser) {
privateBtns.forEach((btn) =>
btn.classList.remove('element-display-remove'),
Expand Down Expand Up @@ -127,7 +127,6 @@ async function handleSync(
}

function showToast(message, type) {
console.log(typeof message);
if (typeof message === 'string') {
toast.innerHTML = `<div class="message">${message}</div>`;
}
Expand Down Expand Up @@ -171,11 +170,11 @@ const repoSyncHandler = async (event) => {
status.textContent = SYNC_IN_PROGRESS;

try {
const response = await fetch(REPO_SYNC_API_URL, { mode: 'no-cors' });
console.log(response);
if (response.ok) {
const apiResponse = await fetch(REPO_SYNC_API_URL);
const response = await apiResponse.json();
if (apiResponse.ok) {
repoSyncStatusUpdate.textContent = SYNC_SUCCESSFUL;
showToast(response.body, 'success');
showToast(response, 'success');
} else {
repoSyncStatusUpdate.textContent = SYNC_FAILED;
showToast('API response not as expected', 'failure');
Expand Down

0 comments on commit ada3f6b

Please sign in to comment.