Skip to content

Commit b4d61bc

Browse files
committed
✨ Integrated Chrome extension with Django backend for LeetCode helper
1 parent f510d74 commit b4d61bc

23 files changed

+66
-2
lines changed

extension/popup.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
console.log("📦 popup.js loaded");
12
document.getElementById("getHelp").addEventListener("click", async () => {
23
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
34
const tab = tabs[0];
@@ -8,6 +9,19 @@ document.getElementById("getHelp").addEventListener("click", async () => {
89
console.log("Problem Title:", title);
910

1011
// For tomorrow: send to Django here
11-
// fetch("http://127.0.0.1:8000/api/...", { method: "POST", body: ... })
12+
fetch("http://127.0.0.1:8000/api/solve/", {
13+
method: "POST",
14+
headers: {
15+
"Content-Type": "application/json"
16+
},
17+
body: JSON.stringify({
18+
title: "Two Sum - LeetCode",
19+
url: "https://leetcode.com/problems/two-sum"
20+
})
21+
})
22+
.then(response => response.json())
23+
.then(data => console.log("✅ Response from Django:", data))
24+
.catch(error => console.error("❌ Error:", error));
25+
1226
});
1327
});

leetcode_backend/api/__init__.py

Whitespace-only changes.
148 Bytes
Binary file not shown.
192 Bytes
Binary file not shown.
506 Bytes
Binary file not shown.
189 Bytes
Binary file not shown.
293 Bytes
Binary file not shown.
1.11 KB
Binary file not shown.

leetcode_backend/api/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

leetcode_backend/api/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ApiConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'api'

0 commit comments

Comments
 (0)