Skip to content

Commit

Permalink
🚨 Add global variable declarations for lucide, toastr, and grecaptcha…
Browse files Browse the repository at this point in the history
… in multiple JS files
  • Loading branch information
zachlagden committed Dec 5, 2024
1 parent db34149 commit 8805dee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/static/js/app_api_keys.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global lucide, toastr */

// Modal elements
const createKeyModal = document.getElementById('createKeyModal');
const createKeyBtn = document.getElementById('createKeyBtn');
Expand Down
2 changes: 2 additions & 0 deletions src/static/js/app_dashboard.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global lucide, toastr, $ */

const dashboardData = {
user: {
name: 'Failed to fetch user data',
Expand Down
2 changes: 2 additions & 0 deletions src/static/js/login.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global lucide, grecaptcha */

// Helper functions for UI manipulation
function setButtonLoading(button, isLoading) {
const text = button.querySelector('span');
Expand Down
4 changes: 4 additions & 0 deletions src/static/js/shared.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global lucide, toastr */

// static/js/shared.js

// Initialize toastr options
Expand All @@ -11,6 +13,7 @@ toastr.options = {
lucide.createIcons();

// Utility function for handling error messages
/* exported showError */
function showError(formId, message) {
const errorDiv = document.querySelector(`${formId} #errorMessage`);
const errorText = errorDiv.querySelector('p');
Expand All @@ -26,6 +29,7 @@ function showError(formId, message) {
}

// Utility function for showing loading state on submit buttons
/* exported setButtonLoading */
function setButtonLoading(button, isLoading) {
const span = button.querySelector('span');
const originalText = span.textContent;
Expand Down
4 changes: 3 additions & 1 deletion src/static/js/signup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global lucide, grecaptcha */

// Constants
const RECAPTCHA_SITE_KEY = '6LdKgI8qAAAAAFCPWoutXxb3bRw2CdEAzRHnYP5P';

Expand Down Expand Up @@ -236,7 +238,7 @@ document.addEventListener('DOMContentLoaded', function () {
const data = await response.json();

if (data.status === 'success') {
window.location.href = '/login';
window.location.href = escape("/login")
} else {
throw new Error(data.message || 'Signup failed');
}
Expand Down

0 comments on commit 8805dee

Please sign in to comment.