diff --git a/index.html b/index.html
index 030a6ff..5d9a421 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
Vite App
+ Où atterrir
diff --git a/package-lock.json b/package-lock.json
index 0fc2c45..0b9f89a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,9 +16,11 @@
"@rushstack/eslint-patch": "^1.1.4",
"@vitejs/plugin-vue": "^3.0.3",
"@vue/eslint-config-prettier": "^7.0.0",
+ "axios": "^1.0.0",
"eslint": "^8.22.0",
"eslint-plugin-vue": "^9.3.0",
"prettier": "^2.7.1",
+ "querystring-es3": "^0.2.1",
"vite": "^3.0.9"
}
},
@@ -366,6 +368,23 @@
"node": ">=8"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "dev": true
+ },
+ "node_modules/axios": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.0.0.tgz",
+ "integrity": "sha512-SsHsGFN1qNPFT5QhSoSD37SHDfGyLSW5AESmyLk2JeCMHv5g0I9g0Hz/zQHx2KNe0jGXh2q2hAm7OdkXm360CA==",
+ "dev": true,
+ "dependencies": {
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -443,6 +462,18 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -503,6 +534,15 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -1238,6 +1278,40 @@
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
"dev": true
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dev": true,
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -1568,6 +1642,27 @@
"node": ">=8.6"
}
},
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -1864,6 +1959,12 @@
"node": ">=6.0.0"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "dev": true
+ },
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
@@ -1873,6 +1974,15 @@
"node": ">=6"
}
},
+ "node_modules/querystring-es3": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz",
+ "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.x"
+ }
+ },
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -2578,6 +2688,23 @@
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true
},
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "dev": true
+ },
+ "axios": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.0.0.tgz",
+ "integrity": "sha512-SsHsGFN1qNPFT5QhSoSD37SHDfGyLSW5AESmyLk2JeCMHv5g0I9g0Hz/zQHx2KNe0jGXh2q2hAm7OdkXm360CA==",
+ "dev": true,
+ "requires": {
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -2640,6 +2767,15 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2683,6 +2819,12 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true
+ },
"dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -3134,6 +3276,23 @@
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
"dev": true
},
+ "follow-redirects": {
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
+ "dev": true
+ },
+ "form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dev": true,
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ }
+ },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -3385,6 +3544,21 @@
"picomatch": "^2.3.1"
}
},
+ "mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.52.0"
+ }
+ },
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -3569,12 +3743,24 @@
"fast-diff": "^1.1.2"
}
},
+ "proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "dev": true
+ },
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"dev": true
},
+ "querystring-es3": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz",
+ "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==",
+ "dev": true
+ },
"queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
diff --git a/package.json b/package.json
index 7ae2973..8f8fdc2 100644
--- a/package.json
+++ b/package.json
@@ -16,9 +16,11 @@
"@rushstack/eslint-patch": "^1.1.4",
"@vitejs/plugin-vue": "^3.0.3",
"@vue/eslint-config-prettier": "^7.0.0",
+ "axios": "^1.0.0",
"eslint": "^8.22.0",
"eslint-plugin-vue": "^9.3.0",
"prettier": "^2.7.1",
+ "querystring-es3": "^0.2.1",
"vite": "^3.0.9"
}
}
diff --git a/src/App.vue b/src/App.vue
index e864195..721b2db 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,85 +1,30 @@
+
+
-
-
-
-
-
-
- Home
- About
-
-
+ Où atterrir
+
diff --git a/src/api/graphql-axios.js b/src/api/graphql-axios.js
new file mode 100644
index 0000000..5dd4a11
--- /dev/null
+++ b/src/api/graphql-axios.js
@@ -0,0 +1,33 @@
+import axios from 'axios'
+
+// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
+
+// console.log('drupalSettings', drupalSettings)
+console.log(window.location)
+
+const MGQ = axios.create({
+ baseURL: `${window.location.origin}/api/mgq`,
+ withCredentials: true,
+ headers: {
+ Accept: 'application/json',
+ // Accept: 'application/vnd.api+json'
+ // Authorization: 'Basic {token}',
+ 'Content-Type': 'application/json'
+ }
+})
+
+MGQ.interceptors.response.use(
+ response => {
+ return Promise.resolve(response)
+ },
+ error => {
+ const { status } = error.response
+ console.warn('error in graphql-axios', status)
+ // if (status === 403) {
+ // window.location = '/'
+ // }
+ return Promise.reject(error)
+ }
+)
+
+export default MGQ
diff --git a/src/api/json-axios.js b/src/api/json-axios.js
new file mode 100644
index 0000000..b7ae7b6
--- /dev/null
+++ b/src/api/json-axios.js
@@ -0,0 +1,32 @@
+import axios from 'axios'
+
+// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
+
+// console.log('drupalSettings', drupalSettings)
+console.log(window.location)
+
+const JSONAPI = axios.create({
+ baseURL: `${window.location.origin}/api/jsonapi`,
+ withCredentials: true,
+ headers: {
+ Accept: 'application/vnd.api+json'
+ // Authorization: 'Basic {token}',
+ // 'Content-Type': 'application/json'
+ }
+})
+
+JSONAPI.interceptors.response.use(
+ response => {
+ return Promise.resolve(response)
+ },
+ error => {
+ const { status } = error.response
+ console.warn('error in json-axios', status)
+ // if (status === 403) {
+ // window.location = '/'
+ // }
+ return Promise.reject(error)
+ }
+)
+
+export default JSONAPI
diff --git a/src/api/rest-axios.js b/src/api/rest-axios.js
new file mode 100644
index 0000000..c93dce9
--- /dev/null
+++ b/src/api/rest-axios.js
@@ -0,0 +1,45 @@
+import axios from 'axios'
+
+// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
+
+// console.log('drupalSettings', drupalSettings)
+// console.log('window.location.origin', window.location.origin)
+
+// axios.interceptors.response.use(
+// response => {
+// return Promise.resolve(response)
+// },
+// error => {
+// const { status } = error.response
+// console.warn('error in rest-axios', status)
+// if (status === 403) {
+// window.location = '/'
+// }
+// return Promise.reject(error)
+// }
+// )
+
+const REST = axios.create({
+ baseURL: `${window.location.origin}/api`,
+ withCredentials: true,
+ headers: {
+ // Authorization: 'Bearer {token}',
+ 'Content-Type': 'application/json'
+ }
+})
+
+REST.interceptors.response.use(
+ response => {
+ return Promise.resolve(response)
+ },
+ error => {
+ const { status } = error.response
+ console.warn('error in rest-axios', status)
+ // if (status === 403) {
+ // window.location = '/'
+ // }
+ return Promise.reject(error)
+ }
+)
+
+export default REST
diff --git a/src/assets/base.css b/src/assets/base.css
index 71dc55a..19856a9 100644
--- a/src/assets/base.css
+++ b/src/assets/base.css
@@ -1,74 +1,3 @@
-/* color palette from */
-:root {
- --vt-c-white: #ffffff;
- --vt-c-white-soft: #f8f8f8;
- --vt-c-white-mute: #f2f2f2;
-
- --vt-c-black: #181818;
- --vt-c-black-soft: #222222;
- --vt-c-black-mute: #282828;
-
- --vt-c-indigo: #2c3e50;
-
- --vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
- --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
- --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
- --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
-
- --vt-c-text-light-1: var(--vt-c-indigo);
- --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
- --vt-c-text-dark-1: var(--vt-c-white);
- --vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
-}
-
-/* semantic color variables for this project */
-:root {
- --color-background: var(--vt-c-white);
- --color-background-soft: var(--vt-c-white-soft);
- --color-background-mute: var(--vt-c-white-mute);
-
- --color-border: var(--vt-c-divider-light-2);
- --color-border-hover: var(--vt-c-divider-light-1);
-
- --color-heading: var(--vt-c-text-light-1);
- --color-text: var(--vt-c-text-light-1);
-
- --section-gap: 160px;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --color-background: var(--vt-c-black);
- --color-background-soft: var(--vt-c-black-soft);
- --color-background-mute: var(--vt-c-black-mute);
-
- --color-border: var(--vt-c-divider-dark-2);
- --color-border-hover: var(--vt-c-divider-dark-1);
-
- --color-heading: var(--vt-c-text-dark-1);
- --color-text: var(--vt-c-text-dark-2);
- }
-}
-
-*,
-*::before,
-*::after {
- box-sizing: border-box;
- margin: 0;
- position: relative;
- font-weight: normal;
-}
-
-body {
- min-height: 100vh;
- color: var(--color-text);
- background: var(--color-background);
- transition: color 0.5s, background-color 0.5s;
- line-height: 1.6;
- font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
- Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
- font-size: 15px;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
+body{
+ font-size: 16px;
+}
\ No newline at end of file
diff --git a/src/assets/main.css b/src/assets/main.css
index c133f91..4093d17 100644
--- a/src/assets/main.css
+++ b/src/assets/main.css
@@ -8,28 +8,3 @@
font-weight: normal;
}
-a,
-.green {
- text-decoration: none;
- color: hsla(160, 100%, 37%, 1);
- transition: 0.4s;
-}
-
-@media (hover: hover) {
- a:hover {
- background-color: hsla(160, 100%, 37%, 0.2);
- }
-}
-
-@media (min-width: 1024px) {
- body {
- display: flex;
- place-items: center;
- }
-
- #app {
- display: grid;
- grid-template-columns: 1fr 1fr;
- padding: 0 2rem;
- }
-}
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
deleted file mode 100644
index 0a0988b..0000000
--- a/src/components/HelloWorld.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
{{ msg }}
-
- You’ve successfully created a project with
- Vite +
- Vue 3 .
-
-
-
-
-
diff --git a/src/components/TheWelcome.vue b/src/components/TheWelcome.vue
deleted file mode 100644
index 5e64625..0000000
--- a/src/components/TheWelcome.vue
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
-
-
- Documentation
-
- Vue’s
- official documentation
- provides you with all information you need to get started.
-
-
-
-
-
-
- Tooling
-
- This project is served and bundled with
- Vite . The
- recommended IDE setup is
- VSCode +
- Volar . If
- you need to test your components and web pages, check out
- Cypress and
- Cypress Component Testing .
-
-
-
- More instructions are available in README.md
.
-
-
-
-
-
-
- Ecosystem
-
- Get official tools and libraries for your project:
- Pinia ,
- Vue Router ,
- Vue Test Utils , and
- Vue Dev Tools . If
- you need more resources, we suggest paying
- Awesome Vue
- a visit.
-
-
-
-
-
-
- Community
-
- Got stuck? Ask your question on
- Vue Land , our official
- Discord server, or
- StackOverflow . You should also subscribe to
- our mailing list and follow
- the official
- @vuejs
- twitter account for latest news in the Vue world.
-
-
-
-
-
-
- Support Vue
-
- As an independent project, Vue relies on community backing for its sustainability. You can help
- us by
- becoming a sponsor .
-
-
diff --git a/src/components/WelcomeItem.vue b/src/components/WelcomeItem.vue
deleted file mode 100644
index ba0def3..0000000
--- a/src/components/WelcomeItem.vue
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
diff --git a/src/components/block/LoginBlock.vue b/src/components/block/LoginBlock.vue
new file mode 100644
index 0000000..8875b33
--- /dev/null
+++ b/src/components/block/LoginBlock.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
diff --git a/src/components/block/UserBlock.vue b/src/components/block/UserBlock.vue
new file mode 100644
index 0000000..42d8ee6
--- /dev/null
+++ b/src/components/block/UserBlock.vue
@@ -0,0 +1,41 @@
+
+
+
+ UserBlock
+
+
+
+
+
diff --git a/src/components/block/UserTools.vue b/src/components/block/UserTools.vue
new file mode 100644
index 0000000..603dd61
--- /dev/null
+++ b/src/components/block/UserTools.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
diff --git a/src/components/icons/IconCommunity.vue b/src/components/icons/IconCommunity.vue
deleted file mode 100644
index 2dc8b05..0000000
--- a/src/components/icons/IconCommunity.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/src/components/icons/IconDocumentation.vue b/src/components/icons/IconDocumentation.vue
deleted file mode 100644
index 6d4791c..0000000
--- a/src/components/icons/IconDocumentation.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/src/components/icons/IconEcosystem.vue b/src/components/icons/IconEcosystem.vue
deleted file mode 100644
index c3a4f07..0000000
--- a/src/components/icons/IconEcosystem.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/src/components/icons/IconSupport.vue b/src/components/icons/IconSupport.vue
deleted file mode 100644
index 7452834..0000000
--- a/src/components/icons/IconSupport.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/src/components/icons/IconTooling.vue b/src/components/icons/IconTooling.vue
deleted file mode 100644
index 660598d..0000000
--- a/src/components/icons/IconTooling.vue
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
diff --git a/src/router/index.js b/src/router/index.js
index a49ae50..e8f9ceb 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,22 +1,21 @@
import { createRouter, createWebHistory } from 'vue-router'
-import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
- {
- path: '/',
- name: 'home',
- component: HomeView
- },
- {
- path: '/about',
- name: 'about',
- // route level code-splitting
- // this generates a separate chunk (About.[hash].js) for this route
- // which is lazy-loaded when the route is visited.
- component: () => import('../views/AboutView.vue')
- }
+ // {
+ // path: '/',
+ // name: 'home',
+ // component: HomeView
+ // },
+ // {
+ // path: '/about',
+ // name: 'about',
+ // // route level code-splitting
+ // // this generates a separate chunk (About.[hash].js) for this route
+ // // which is lazy-loaded when the route is visited.
+ // component: () => import('../views/AboutView.vue')
+ // }
]
})
diff --git a/src/stores/user.js b/src/stores/user.js
new file mode 100644
index 0000000..6052baf
--- /dev/null
+++ b/src/stores/user.js
@@ -0,0 +1,135 @@
+import { defineStore } from 'pinia'
+import REST from '@api/rest-axios'
+import JSONAPI from '@api/json-axios'
+import qs from 'querystring-es3'
+
+export const UserStore = defineStore({
+ id: 'user',
+ state: () => ({
+ isloggedin: false,
+ csrf_token: null,
+ logout_token: null,
+ uid: 0,
+ uuid: 0,
+ mail: '',
+ name: null,
+ roles: null,
+ logginMessage: null
+ }),
+ getters: {
+
+ },
+ actions: {
+ checkUser () {
+ JSONAPI.get('').then(({ data }) => {
+ console.log('checkuser jsonapi', data)
+ if (data.meta && data.meta.links.me) {
+ JSONAPI.get(data.meta.links.me.href).then(({ data : { data } }) => {
+ console.log('checkuser jsonapi get user', data)
+ this.uid = data.attributes.drupal_internal__uid
+ this.mail = data.attributes.mail
+ this.name = data.attributes.name
+ this.isloggedin = data.attributes.status
+ console.log('user store checkuser isloggedin', this.isloggedin);
+ })
+ }
+ })
+ },
+ userLogin (credentials) {
+ console.log('user store userLogin', credentials);
+ return new Promise((resolve, reject) => {
+ this.getToken(credentials)
+ .then((response) => {
+ console.log('userLogin getToken response', response)
+
+ if (response.status === 200) {
+ this.uid = response.data.current_user.uid
+ // state.username = data.username;
+ this.mail = response.data.current_user.mail
+ this.csrf_token = response.data.csrf_token
+ // this.isloggedin = true
+ this.logout_token = response.data.logout_token
+ this.getUser().then(userdata => {
+ console.log('User Loggedin')
+ resolve()
+ })
+ } else {
+ this.loginMessage = response.data.message
+ console.warn('Issue with getToken', response)
+ console.log('user loggein failed', this.loginMessage)
+ Promise.reject(new Error('user loggin failed'))
+ }
+ })
+ .catch(error => {
+ console.warn('Issue with Dispatch getToken', error)
+ Promise.reject(error)
+ })
+ })
+ },
+ getToken (credentials) {
+ console.log('userStore getToken', credentials)
+ return REST.post('/user/login?_format=json',
+ credentials,
+ {
+ validateStatus: function (status) {
+ return status >= 200 && status < 500
+ }
+ })
+ },
+ getUser () {
+ console.log('user store getUser');
+ return new Promise((resolve, reject) => {
+ REST.get('/session/token').then(({ data }) => {
+ console.log('csrf_token', data)
+ this.csrf_token = data
+ console.log('state csrf_token', this.csrf_token)
+ const params = {
+ token: this.csrf_token
+ }
+ REST.get(`/user/${this.uid}?_format=json`, params)
+ .then(({ data }) => {
+ console.log('user REST getUser data', data)
+ console.log('roles', data.roles)
+ // with session_limit, only here we are certain that the user is logged
+ // this.user = data
+ // this.mail = data.mail[0].value
+ this.uuid = data.uuid[0].value
+ this.name = data.name[0].value
+ // with session_limit, only here we are certain that the user is logged
+ this.isloggedin = true
+ if (data.roles) {
+ this.roles = data.roles
+ }
+ // console.log('customer_profiles', data.customer_profiles.length)
+ // if (data.customer_profiles.length) {
+ // dispatch('getUserProfiles', data.customer_profiles[data.customer_profiles.length - 1].target_id)
+ // }
+ resolve()
+ })
+ .catch(error => {
+ console.warn('Issue with getUser', error)
+ Promise.reject(error)
+ })
+ })
+ })
+ },
+ userLogout () {
+ const credentials = qs.stringify({
+ token: this.csrf_token
+ })
+ return new Promise((resolve, reject) => {
+ REST.post('/user/logout', credentials)
+ .then(resp => {
+ console.log('userStore userLogout resp', resp)
+ this.isloggedin = false
+ // window.location.reload(true) ???
+ resolve()
+ })
+ .catch(error => {
+ console.warn('Issue with logout', error)
+ Promise.reject(error)
+ })
+ })
+ }
+ }
+})
\ No newline at end of file
diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue
deleted file mode 100644
index 756ad2a..0000000
--- a/src/views/AboutView.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
This is an about page
-
-
-
-
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
deleted file mode 100644
index 6bb706f..0000000
--- a/src/views/HomeView.vue
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
diff --git a/vite.config.js b/vite.config.js
index de5cb31..5d6571e 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -8,7 +8,9 @@ export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
+ '@components': fileURLToPath(new URL('./src/components', import.meta.url)),
+ '@api': fileURLToPath(new URL('./src/api', import.meta.url))
}
}
})