Skip to content

Commit

Permalink
gfgfgf
Browse files Browse the repository at this point in the history
  • Loading branch information
LongmetalAdmin committed Feb 28, 2024
1 parent b7cdd1c commit dbddba1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ form.onsubmit = async (event) => {
form.reset();
};


//display team
const getTeams = async () => {
const allTeams = await db.teams.reverse().toArray();
Expand Down
52 changes: 26 additions & 26 deletions pages/teamdetails.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
document.addEventListener('DOMContentLoaded', async () => {
// Initialize Dexie database
const db = new Dexie("Team Tracking App");
db.version(1).stores({
teams: "++id, teamname, globalid"
});

// Retrieve data from IndexedDB and fill the textbox if it exists
const existingData = await db.teams.get(1); // Assuming you have only one record
if (existingData && existingData.todo) {
document.getElementById('teamname').value = existingData.teamname;
}

// Event listener for submit button
document.getElementById('submitButton').addEventListener('click', async () => {
const newData = document.getElementById('teamname').value;

// Save or update data in IndexedDB
if (existingData) {
await db.teams.update(1, { teamname: newData });
} else {
await db.teams.add({ teamname: newData });
}

alert('Data saved successfully!');
});
});
// Initialize Dexie database
const db = new Dexie("Team Tracking App");
db.version(1).stores({
teams: "++id, teamname, globalid"
});
// Retrieve data from IndexedDB and fill the textbox if it exists
const existingData = await db.teams.get(1); // Assuming you have only one record
if (existingData && existingData.todo) {
document.getElementById('teamname').value = existingData.teamname;
}
// Event listener for submit button
document.getElementById('submitButton').addEventListener('click', async () => {
const newData = document.getElementById('teamname').value;
// Save or update data in IndexedDB
if (existingData) {
await db.teams.update(1, { teamname: newData });
} else {
await db.teams.add({ teamname: newData });
}
alert('Data saved successfully!');
});
});

0 comments on commit dbddba1

Please sign in to comment.