-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove jq/refactor codebase
- Loading branch information
1 parent
654f322
commit bcd26b5
Showing
12 changed files
with
76 additions
and
94 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
|
||
add_ajax_action('login'); | ||
add_ajax_action('sendMail'); | ||
add_ajax_action('contact'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
}, | ||
"dependencies": { | ||
"axios": "^1.6.7", | ||
"jquery": "^3.7.1", | ||
"sweetalert2": "^11.6.15" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
import jQuery from 'jquery' | ||
|
||
window.$ = window.jQuery = jQuery | ||
import axios from 'axios' | ||
|
||
window.axios = axios | ||
|
||
import { initContactForm } from './contact' | ||
import { initLoginForm } from './login' | ||
|
||
$(function () { | ||
document.addEventListener('DOMContentLoaded', () => { | ||
initContactForm() | ||
initLoginForm() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
import axios from 'axios' | ||
import Toast from './libs/Toast' | ||
|
||
export function initContactForm() { | ||
const preloader = $('.js-preloader-main') | ||
$(document).on('submit', '.js-contact-form', async function (event) { | ||
event.preventDefault() | ||
const contactForm = document.querySelector('.js-contact-form') | ||
|
||
const form = $(this) | ||
const formData = new FormData() | ||
if (!contactForm) return | ||
contactForm.addEventListener('submit', async event => { | ||
event.preventDefault() | ||
|
||
formData.append('name', form.find('input[name="name"]').val()) | ||
formData.append('mail', form.find('input[name="mail"]').val()) | ||
formData.append('action', 'sendMail') | ||
const formData = new FormData(contactForm) | ||
formData.append('action', 'contact') | ||
formData.append('nonce', data.nonce) | ||
preloader.addClass('js-preloading') | ||
|
||
const preloader = document.querySelector('.js-preloader-main') | ||
preloader.classList.add('js-preloading') | ||
|
||
try { | ||
const { data: response } = await axios.post(data.ajax_url, formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data' | ||
}, | ||
params: { | ||
action: 'sendMail', | ||
nonce: data.nonce | ||
} | ||
headers: { 'Content-Type': 'multipart/form-data' }, | ||
params: { action: 'contact' } | ||
}) | ||
|
||
if (response.type === 'success') { | ||
Toast.fire({ icon: 'success', iconColor: '#007cba', title: response.message }) | ||
} else { | ||
Toast.fire({ icon: 'error', iconColor: 'red', title: 'Error sending email' }) | ||
const toastConfig = { | ||
icon: response.type, | ||
iconColor: response.type === 'success' ? '#007cba' : 'red', | ||
title: response.message | ||
} | ||
|
||
Toast.fire(toastConfig) | ||
} catch (error) { | ||
console.log(error) | ||
console.error(error) | ||
} | ||
|
||
preloader.removeClass('js-preloading') | ||
form.trigger('reset') | ||
preloader.classList.remove('js-preloading') | ||
contactForm.reset() | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1242,9 +1242,9 @@ | |
"@types/node" "*" | ||
|
||
"@types/node@*": | ||
version "20.11.16" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.16.tgz#4411f79411514eb8e2926f036c86c9f0e4ec6708" | ||
integrity sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ== | ||
version "20.11.17" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.17.tgz#cdd642d0e62ef3a861f88ddbc2b61e32578a9292" | ||
integrity sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw== | ||
dependencies: | ||
undici-types "~5.26.4" | ||
|
||
|
@@ -1828,14 +1828,15 @@ [email protected]: | |
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== | ||
|
||
call-bind@^1.0.5, call-bind@^1.0.6: | ||
version "1.0.6" | ||
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.6.tgz#6c46675fc7a5e9de82d75a233d586c8b7ac0d931" | ||
integrity sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg== | ||
version "1.0.7" | ||
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" | ||
integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== | ||
dependencies: | ||
es-define-property "^1.0.0" | ||
es-errors "^1.3.0" | ||
function-bind "^1.1.2" | ||
get-intrinsic "^1.2.3" | ||
set-function-length "^1.2.0" | ||
get-intrinsic "^1.2.4" | ||
set-function-length "^1.2.1" | ||
|
||
callsites@^3.0.0: | ||
version "3.1.0" | ||
|
@@ -1861,9 +1862,9 @@ caniuse-api@^3.0.0: | |
lodash.uniq "^4.5.0" | ||
|
||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001578, caniuse-lite@^1.0.30001580: | ||
version "1.0.30001585" | ||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001585.tgz#0b4e848d84919c783b2a41c13f7de8ce96744401" | ||
integrity sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q== | ||
version "1.0.30001587" | ||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz#a0bce920155fa56a1885a69c74e1163fc34b4881" | ||
integrity sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA== | ||
|
||
chalk@^2.4.2: | ||
version "2.4.2" | ||
|
@@ -2314,12 +2315,12 @@ default-gateway@^6.0.3: | |
execa "^5.0.0" | ||
|
||
define-data-property@^1.0.1, define-data-property@^1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.2.tgz#f3c33b4f0102360cd7c0f5f28700f5678510b63a" | ||
integrity sha512-SRtsSqsDbgpJBbW3pABMCOt6rQyeM8s8RiyeSN8jYG8sYmt/kGJejbydttUsnDs1tadr19tvhT4ShwMyoqAm4g== | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.3.tgz#281845e04737d709c2de99e278546189b65d3055" | ||
integrity sha512-h3GBouC+RPtNX2N0hHVLo2ZwPYurq8mLmXpOLTsw71gr7lHt5VaI4vVkDUNOfiWmm48JEXe3VM7PmLX45AMmmg== | ||
dependencies: | ||
es-errors "^1.3.0" | ||
get-intrinsic "^1.2.2" | ||
get-intrinsic "^1.2.4" | ||
gopd "^1.0.1" | ||
has-property-descriptors "^1.0.1" | ||
|
||
|
@@ -2467,9 +2468,9 @@ [email protected]: | |
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== | ||
|
||
electron-to-chromium@^1.4.648: | ||
version "1.4.661" | ||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.661.tgz#b28d63468b06e75610ed2b0f8e5f5f669a57bd91" | ||
integrity sha512-AFg4wDHSOk5F+zA8aR+SVIOabu7m0e7BiJnigCvPXzIGy731XENw/lmNxTySpVFtkFEy+eyt4oHhh5FF3NjQNw== | ||
version "1.4.667" | ||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.667.tgz#2767d998548e5eeeaf8bdaffd67b56796bfbed3d" | ||
integrity sha512-66L3pLlWhTNVUhnmSA5+qDM3fwnXsM6KAqE36e2w4KN0g6pkEtlT5bs41FQtQwVwKnfhNBXiWRLPs30HSxd7Kw== | ||
|
||
elliptic@^6.5.3, elliptic@^6.5.4: | ||
version "6.5.4" | ||
|
@@ -2524,6 +2525,13 @@ error-ex@^1.3.1: | |
dependencies: | ||
is-arrayish "^0.2.1" | ||
|
||
es-define-property@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" | ||
integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== | ||
dependencies: | ||
get-intrinsic "^1.2.4" | ||
|
||
es-errors@^1.3.0: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" | ||
|
@@ -2817,7 +2825,7 @@ get-caller-file@^2.0.5: | |
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" | ||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== | ||
|
||
get-intrinsic@^1.1.3, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: | ||
get-intrinsic@^1.1.3, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: | ||
version "1.2.4" | ||
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" | ||
integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== | ||
|
@@ -2918,11 +2926,11 @@ has-flag@^4.0.0: | |
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== | ||
|
||
has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" | ||
integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" | ||
integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== | ||
dependencies: | ||
get-intrinsic "^1.2.2" | ||
es-define-property "^1.0.0" | ||
|
||
has-proto@^1.0.1: | ||
version "1.0.1" | ||
|
@@ -2957,9 +2965,9 @@ hash.js@^1.0.0, hash.js@^1.0.3: | |
minimalistic-assert "^1.0.1" | ||
|
||
hasown@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" | ||
integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa" | ||
integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== | ||
dependencies: | ||
function-bind "^1.1.2" | ||
|
||
|
@@ -3281,11 +3289,6 @@ jest-worker@^27.4.5: | |
merge-stream "^2.0.0" | ||
supports-color "^8.0.0" | ||
|
||
jquery@^3.7.1: | ||
version "3.7.1" | ||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de" | ||
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg== | ||
|
||
js-tokens@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" | ||
|
@@ -4642,7 +4645,7 @@ [email protected]: | |
parseurl "~1.3.3" | ||
send "0.18.0" | ||
|
||
set-function-length@^1.2.0: | ||
set-function-length@^1.2.1: | ||
version "1.2.1" | ||
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425" | ||
integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== | ||
|