Skip to content

Commit

Permalink
[+] docking backend
Browse files Browse the repository at this point in the history
  • Loading branch information
LS-KR committed Nov 14, 2023
1 parent 8a031d2 commit 110b35b
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 128 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"format": "prettier --tab-width 4 --write src/"
},
"dependencies": {
"inversify": "^6.0.2",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"scss": "^0.2.4",
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions src/json/admin.json

This file was deleted.

14 changes: 0 additions & 14 deletions src/json/book.json

This file was deleted.

1 change: 0 additions & 1 deletion src/json/user.json

This file was deleted.

4 changes: 4 additions & 0 deletions src/logic/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import urlJoin from "url-join";

export const backendHost = "http://127.0.0.1:8086";
export const backendUrl = urlJoin(backendHost, "data");
9 changes: 9 additions & 0 deletions src/logic/getData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import urlJoin from "url-join";
import { backendUrl, backendHost } from "./constants";

export default function getData(path: string): string {
var request = new XMLHttpRequest();
request.open("get", urlJoin(backendUrl, path), false);
request.send();
return request.responseText;
}
4 changes: 2 additions & 2 deletions src/views/Admin/Book.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import Sidebar from "@/components/Sidebar.vue";
import { Options, Vue } from "vue-class-component";
import JSONTable from "@/components/JSONTable.vue";
import rawData from "@/json/book.json";
import getData from "@/logic/getData";
export default class Book extends Vue {
bookData = "";
created(): void {
if (!localStorage.getItem("login")) this.$router.push("/login");
this.bookData = JSON.stringify(rawData);
this.bookData = getData("book.json");
}
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/views/Admin/Manage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import Sidebar from "@/components/Sidebar.vue";
import { Options, Vue } from "vue-class-component";
import JSONTable from "@/components/JSONTable.vue";
import rawData from "@/json/admin.json";
import getData from "../../logic/getData";
export default class Manage extends Vue {
adminData = "";
created(): void {
if (!localStorage.getItem("login")) this.$router.push("/login");
this.adminData = JSON.stringify(rawData);
this.adminData = getData("admin.json");
}
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/views/Admin/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import Sidebar from "@/components/Sidebar.vue";
import { Options, Vue } from "vue-class-component";
import JSONTable from "@/components/JSONTable.vue";
import rawData from "@/json/user.json";
import getData from "@/logic/getData";
export default class User extends Vue {
userData = "";
created(): void {
if (!localStorage.getItem("login")) this.$router.push("/login");
this.userData = JSON.stringify(rawData);
this.userData = getData("user.json");
}
}
</script>
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.md", "src/**/*.json"],
"include": ["env.d.ts", "src/**/*", "src/**/*.ts", "src/**/*.vue", "src/**/*.md", "src/**/*.json"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"experimentalDecorators": true
}
}
3 changes: 2 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
"types": ["node"],
"experimentalDecorators": true
}
}
3 changes: 2 additions & 1 deletion tsconfig.vitest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
"types": ["node", "jsdom"],
"experimentalDecorators": true
}
}
5 changes: 5 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
devServer: {
proxy: 'http://127.0.0.1:8086',
}
}
Loading

0 comments on commit 110b35b

Please sign in to comment.