Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
clean: add obj
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Sep 12, 2024
1 parent 69d1ab2 commit 62ade6c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ const save_code = () => {
title: "ذخیره کد",
text: "لطفا ابتدا کد خود را بنویسید.",
});

return;
}

Expand All @@ -321,11 +321,12 @@ const save_code = () => {
if (login !== "") {
const xhr = new XMLHttpRequest();
xhr.onload = () => {
if (JSON.parse(xhr.response).status === true) {
const obj = JSON.parse(xhr.response);
if (obj.status === true) {
Swal.fire({
icon: "success",
title: "کد شما ذخیره شد.",
html: `<a href='${JSON.parse(xhr.response).data.url}'>مشاهده</a>`,
html: `<a href='${obj.data.url}'>مشاهده</a>`,
});
} else {
Swal.fire({
Expand Down Expand Up @@ -439,7 +440,8 @@ elm_save.addEventListener("click", () => {
if (token !== null) {
const xhr = new XMLHttpRequest();
xhr.onload = () => {
if (JSON.parse(xhr.response).status === true) {
const obj = JSON.parse(xhr.response);
if (obj.status === true) {
save_code();
} else {
get_login();
Expand Down Expand Up @@ -548,7 +550,8 @@ window.addEventListener('load', () => {
const xhr = new XMLHttpRequest();

xhr.onload = () => {
if (JSON.parse(xhr.response).status === true) {
const obj = JSON.parse(xhr.response);
if (obj.status === true) {
in_login();

elm_logout_btn.style.display = "flex";
Expand Down

0 comments on commit 62ade6c

Please sign in to comment.