diff --git a/.vscode/melodii.code-workspace b/.vscode/melodii.code-workspace
index 214f960..40ac21e 100644
--- a/.vscode/melodii.code-workspace
+++ b/.vscode/melodii.code-workspace
@@ -1,7 +1,12 @@
{
"folders": [
{
- "path": "C:\\Users\\Paoda\\Documents\\programming\\neomelodii"
+ "path": "C:\\Users\\Paoda\\Documents\\programming\\neomelodii",
+ "name": "Source Code"
+ },
+ {
+ "path": "C:\\Users\\Paoda\\AppData\\Roaming\\melodii",
+ "name": "Storage"
}
]
}
\ No newline at end of file
diff --git a/src/components/Body.js b/src/components/Body.js
index 8b91124..d62a54a 100644
--- a/src/components/Body.js
+++ b/src/components/Body.js
@@ -21,8 +21,8 @@ export default class Body extends React.Component {
if (err) throw err;
console.log("newTable", obj);
- debugger;
self.setState({ table: obj });
+
});
}
componentWillMount() {
diff --git a/src/components/Modal/SettingsManager.js b/src/components/Modal/SettingsManager.js
index 6407bae..8f7117a 100644
--- a/src/components/Modal/SettingsManager.js
+++ b/src/components/Modal/SettingsManager.js
@@ -39,15 +39,21 @@ export default class SettingsManager extends Modal {
}
deleteTable() {
- if (Settings.has("tableJSON")) Settings.delete("tableJSON");
+ // const template = this.template;
+ // template.id = "-1" // Impossible ID
+
+ const template = {
+ thead: {
+ tr: ["Artist", "Title", "Album", "Year", "Genre", "Time"] //contains
strings
+ },
+ tbody: []
+ };
+
+ if (Settings.has("tableJSON")) Settings.set("tableJSON", template);
else console.info("There was no Table Saved to Delete!");
- const template = this.template;
-
- template.id = "-1"; //Impossible ID.
-
- Emitter.emit("newTable", this.template);
+ Emitter.emit("newTable", template);
}
/**
@@ -55,11 +61,33 @@ export default class SettingsManager extends Modal {
* TODO: Make this a function w/ the one inside of Body.js
*/
async regenTable() {
- if (Settings.has("tableJSON")) Settings.delete("tableJSON");
+
+ /*
+ Rather Large Problem w/ regenTable() and deleteTable()
+ I need const template to be a reference to a different object of this.template
+ (Pass by value instead of pass by reference)
+
+ Both deleteTable() and regenTable() modify this.table, which is not the intended behaviour.
+
+
+ Temporary soltuoin will be to define template in each funciton, but I need to figure out how to
+ copy the object instead of reference the object.
+ */
+ // const template = this.template;
+ // template.id = "-1";
+
+ const template = {
+ thead: {
+ tr: ["Artist", "Title", "Album", "Year", "Genre", "Time"] //contains | strings
+ },
+ tbody: []
+ };
+
+ if (Settings.has("tableJSON")) Settings.set("tableJSON", template);
else console.info("There was no Table Saved to Delete!")
- const tableJSON = await generate("C:\\Users\\Paoda\\Downloads\\Music", this.template);
-
+ const tableJSON = await generate("C:\\Users\\Paoda\\Downloads\\Music", template);
+
Emitter.emit("newTable", tableJSON);
saveTable(tableJSON);
|