Kaydet (Commit) fe0807ec authored tarafından Emincan Özcan's avatar Emincan Özcan

api communication

üst 4eac0df5
......@@ -13,6 +13,7 @@
},
"main": "background.js",
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0"
......@@ -36,6 +37,5 @@
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
"vue-cli-plugin-electron-builder": "~2.0.0-rc.6",
"vue-svg-loader": "^0.17.0-beta.2"
}
}
<template>
<div class="bg-gray-900 text-gray-100 min-h-screen flex">
<div v-if="loading">Loading</div>
<div v-else class="bg-gray-900 text-gray-100 min-h-screen flex">
<Sidebar
class="sticky top-0 left-0 h-screen w-64 bg-gray-700 bg-opacity-25 flex-shrink-0"
/>
......@@ -8,7 +9,14 @@
</template>
<script>
import Sidebar from "./components/Sidebar";
import store from "./global-state/store";
export default {
components: { Sidebar },
setup() {
store.fetchData().then(() => {
store.loading.value = false;
});
return { loading: store.loading };
},
};
</script>
import { ref } from "vue";
import axios from "axios";
const loading = ref(true);
const pardusApps = ref([]);
const nonPardusApps = ref([]);
const appPackages = ref([]);
async function fetchData() {
try {
const response = await axios.get("http://localhost/api/get-all-data");
console.log("apiresponse", response);
const data = response.data.data;
pardusApps.value = data["pardus_apps"];
nonPardusApps.value = data["non_pardus_apps"];
appPackages.value = data["app_packages"];
} catch (e) {
console.error("API DATA FETCH ERROR", e);
}
}
export default {
loading,
pardusApps,
nonPardusApps,
appPackages,
fetchData,
};
......@@ -2157,6 +2157,13 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
babel-eslint@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232"
......@@ -4727,7 +4734,7 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"
follow-redirects@^1.0.0:
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.0.tgz#f5d260f95c5f8c105894491feee5dc8993b402fe"
integrity sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment