فهرست منبع

Bug fix: was previously unable to create transactions.

Lee Morgan 11 ماه پیش
والد
کامیت
d83d2230b7
3فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 2 2
      src/views/css/index.css
  2. 5 3
      src/views/js/data/Transaction.js
  3. 1 1
      src/views/js/pages/CreateTransaction.js

+ 2 - 2
src/views/css/index.css

@@ -29,8 +29,8 @@ body{
 
 .logo{
     position: absolute;
-    top: 35px;
-    left: 35px;
+    top: 15px;
+    left: 15px;
     z-index: 100;
 }
 

+ 5 - 3
src/views/js/data/Transaction.js

@@ -1,4 +1,5 @@
 import Format from "../Format.js";
+import Notifier from "../Notifier.js";
 
 export default class Transaction{
     constructor(parent, id, iv, date, data,){
@@ -14,7 +15,7 @@ export default class Transaction{
         this._note = data.note;
     }
 
-    static create(account, date, amount, tags, location, note, category){j
+    static create(account, date, amount, tags, location, note, category){
         let categoryId = null;
         if(category !== "discretionary"){
             let categorySplit = category.split("-");
@@ -80,10 +81,10 @@ export default class Transaction{
             };
         }
 
-        fetch("/api/transactions", {
+        fetch("/api/transaction", {
             method: method,
             headers: {"Content-Type": "application/json"},
-            body: body
+            body: JSON.stringify(body)
         })
             .then(r=>r.json())
             .then((response)=>{
@@ -95,6 +96,7 @@ export default class Transaction{
                 }
             })
             .catch((err)=>{
+                console.log(err);
                 new Notifier("error", "Something went wrong, try refreshing the page");
                 this._parent.removeTransaction(this);
             });

+ 1 - 1
src/views/js/pages/CreateTransaction.js

@@ -25,7 +25,7 @@ export default class CreateTransaction extends Page{
             document.querySelector(".note").value,
             document.querySelector(".category").value
         );
-        await transaction.save();
+        await transaction.save(true);
         user.account.addTransaction(transaction);
         changePage("home");
    }