No real progress, but syncing from work
This commit is contained in:
parent
8bc042aa19
commit
8bbe9c9fb4
140
lifetracker-vue/package-lock.json
generated
140
lifetracker-vue/package-lock.json
generated
@ -463,9 +463,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/vue-language-core": {
|
"node_modules/@volar/vue-language-core": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.6.4.tgz",
|
||||||
"integrity": "sha512-e9OTDCPa8Wuh0ORhD4z++qTIcrsrqcI9waspr93YcQCq6j+Q+JTFuy7HBSQgyezSAsP6x1WWokKVk4fWWDJQOw==",
|
"integrity": "sha512-1o+cAtN2DIDNAX/HS8rkjZc8wTMTK+zCab/qtYbvEVlmokhZiDrQeoD9/l0Ug7YCNg+mVuMNHKNBY7pX8U2/Jw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-core": "1.4.1",
|
"@volar/language-core": "1.4.1",
|
||||||
@ -594,13 +594,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/vue-typescript": {
|
"node_modules/@volar/vue-typescript": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.6.4.tgz",
|
||||||
"integrity": "sha512-Dz29Qym33P1MSZDTZJ6PPLN1TLQfkX+g2pRnHqLCsFdSUu4yWYnElBURCn5WJkekxV/v+k2T43aur2RCSY3Ovg==",
|
"integrity": "sha512-qKwgP0KVQR/aaH/SN3AP7RB8NnXPWDn3tjyXP6IT6etxkDeZLBLsXWUD9KMak/RvV1DgbXDuz4F9yuZlbt29rA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/typescript": "1.4.1",
|
"@volar/typescript": "1.4.1",
|
||||||
"@volar/vue-language-core": "1.6.3"
|
"@volar/vue-language-core": "1.6.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "*"
|
"typescript": "*"
|
||||||
@ -788,19 +788,6 @@
|
|||||||
"proxy-from-env": "^1.1.0"
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios/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==",
|
|
||||||
"dependencies": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.8",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
@ -1135,16 +1122,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/form-data": {
|
"node_modules/form-data": {
|
||||||
"version": "2.5.1",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.6",
|
"combined-stream": "^1.0.8",
|
||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.12"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
"node_modules/fsevents": {
|
||||||
@ -1611,6 +1598,19 @@
|
|||||||
"form-data": "^2.3.2"
|
"form-data": "^2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/isomorphic-form-data/node_modules/form-data": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.6",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/json-parse-better-errors": {
|
"node_modules/json-parse-better-errors": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
|
||||||
@ -1730,9 +1730,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/node": {
|
"node_modules/node": {
|
||||||
"version": "20.0.0",
|
"version": "20.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/node/-/node-20.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/node/-/node-20.1.0.tgz",
|
||||||
"integrity": "sha512-4R1vw5hKUjQw3x65x9g/ape/XlY/ZFHaQWB+jQLFJIJkVKJPDSY4oj3O6qgXOvv2wwgEpK9J2SvJUjuL6zu0uA==",
|
"integrity": "sha512-KEdvvfuL5jfQTFN6Evul7qqI1zYQ/eljdsIHkQOS+FW86l7ZTNfOEru/OzprVP1X0jLfRDPDz0wvucCOWOotQg==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-bin-setup": "^1.0.0"
|
"node-bin-setup": "^1.0.0"
|
||||||
@ -2060,9 +2060,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rollup": {
|
"node_modules/rollup": {
|
||||||
"version": "3.21.3",
|
"version": "3.21.4",
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.3.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.4.tgz",
|
||||||
"integrity": "sha512-VnPfEG51nIv2xPLnZaekkuN06q9ZbnyDcLkaBdJa/W7UddyhOfMP2yOPziYQfeY7k++fZM8FdQIummFN5y14kA==",
|
"integrity": "sha512-N5LxpvDolOm9ueiCp4NfB80omMDqb45ShtsQw2+OT3f11uJ197dv703NZvznYHP6RWR85wfxanXurXKG3ux2GQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"rollup": "dist/bin/rollup"
|
"rollup": "dist/bin/rollup"
|
||||||
@ -2448,13 +2448,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vue-tsc": {
|
"node_modules/vue-tsc": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.6.4.tgz",
|
||||||
"integrity": "sha512-q7l27j0eSJgyGat0khetrvoeaAHieRZFnf8WAJyKvB3eF0AxmLqfs4ahwZhaojBJjZ/lAXZa+Xt8EX54KzQ34w==",
|
"integrity": "sha512-8rg8S1AhRJ6/WriENQEhyqH5wsxSxuD5iaD+QnkZn2ArZ6evlhqfBAIcVN8mfSyCV9DeLkQXkOSv/MaeJiJPAQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/vue-language-core": "1.6.3",
|
"@volar/vue-language-core": "1.6.4",
|
||||||
"@volar/vue-typescript": "1.6.3",
|
"@volar/vue-typescript": "1.6.4",
|
||||||
"semver": "^7.3.8"
|
"semver": "^7.3.8"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -2769,9 +2769,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@volar/vue-language-core": {
|
"@volar/vue-language-core": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/vue-language-core/-/vue-language-core-1.6.4.tgz",
|
||||||
"integrity": "sha512-e9OTDCPa8Wuh0ORhD4z++qTIcrsrqcI9waspr93YcQCq6j+Q+JTFuy7HBSQgyezSAsP6x1WWokKVk4fWWDJQOw==",
|
"integrity": "sha512-1o+cAtN2DIDNAX/HS8rkjZc8wTMTK+zCab/qtYbvEVlmokhZiDrQeoD9/l0Ug7YCNg+mVuMNHKNBY7pX8U2/Jw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@volar/language-core": "1.4.1",
|
"@volar/language-core": "1.4.1",
|
||||||
@ -2893,13 +2893,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@volar/vue-typescript": {
|
"@volar/vue-typescript": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-1.6.4.tgz",
|
||||||
"integrity": "sha512-Dz29Qym33P1MSZDTZJ6PPLN1TLQfkX+g2pRnHqLCsFdSUu4yWYnElBURCn5WJkekxV/v+k2T43aur2RCSY3Ovg==",
|
"integrity": "sha512-qKwgP0KVQR/aaH/SN3AP7RB8NnXPWDn3tjyXP6IT6etxkDeZLBLsXWUD9KMak/RvV1DgbXDuz4F9yuZlbt29rA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@volar/typescript": "1.4.1",
|
"@volar/typescript": "1.4.1",
|
||||||
"@volar/vue-language-core": "1.6.3"
|
"@volar/vue-language-core": "1.6.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vue/compiler-core": {
|
"@vue/compiler-core": {
|
||||||
@ -3060,18 +3060,6 @@
|
|||||||
"follow-redirects": "^1.15.0",
|
"follow-redirects": "^1.15.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"proxy-from-env": "^1.1.0"
|
"proxy-from-env": "^1.1.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"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==",
|
|
||||||
"requires": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.8",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
@ -3340,12 +3328,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"form-data": {
|
"form-data": {
|
||||||
"version": "2.5.1",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
"combined-stream": "^1.0.6",
|
"combined-stream": "^1.0.8",
|
||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -3670,6 +3658,18 @@
|
|||||||
"integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==",
|
"integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"form-data": "^2.3.2"
|
"form-data": "^2.3.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"form-data": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.6",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"json-parse-better-errors": {
|
"json-parse-better-errors": {
|
||||||
@ -3758,9 +3758,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"version": "20.0.0",
|
"version": "20.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/node/-/node-20.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/node/-/node-20.1.0.tgz",
|
||||||
"integrity": "sha512-4R1vw5hKUjQw3x65x9g/ape/XlY/ZFHaQWB+jQLFJIJkVKJPDSY4oj3O6qgXOvv2wwgEpK9J2SvJUjuL6zu0uA==",
|
"integrity": "sha512-KEdvvfuL5jfQTFN6Evul7qqI1zYQ/eljdsIHkQOS+FW86l7ZTNfOEru/OzprVP1X0jLfRDPDz0wvucCOWOotQg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"node-bin-setup": "^1.0.0"
|
"node-bin-setup": "^1.0.0"
|
||||||
}
|
}
|
||||||
@ -3964,9 +3964,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rollup": {
|
"rollup": {
|
||||||
"version": "3.21.3",
|
"version": "3.21.4",
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.3.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.4.tgz",
|
||||||
"integrity": "sha512-VnPfEG51nIv2xPLnZaekkuN06q9ZbnyDcLkaBdJa/W7UddyhOfMP2yOPziYQfeY7k++fZM8FdQIummFN5y14kA==",
|
"integrity": "sha512-N5LxpvDolOm9ueiCp4NfB80omMDqb45ShtsQw2+OT3f11uJ197dv703NZvznYHP6RWR85wfxanXurXKG3ux2GQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
@ -4232,13 +4232,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vue-tsc": {
|
"vue-tsc": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.6.4.tgz",
|
||||||
"integrity": "sha512-q7l27j0eSJgyGat0khetrvoeaAHieRZFnf8WAJyKvB3eF0AxmLqfs4ahwZhaojBJjZ/lAXZa+Xt8EX54KzQ34w==",
|
"integrity": "sha512-8rg8S1AhRJ6/WriENQEhyqH5wsxSxuD5iaD+QnkZn2ArZ6evlhqfBAIcVN8mfSyCV9DeLkQXkOSv/MaeJiJPAQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@volar/vue-language-core": "1.6.3",
|
"@volar/vue-language-core": "1.6.4",
|
||||||
"@volar/vue-typescript": "1.6.3",
|
"@volar/vue-typescript": "1.6.4",
|
||||||
"semver": "^7.3.8"
|
"semver": "^7.3.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useSessionStore } from "../stores/session";
|
import { useSessionStore } from "../stores/session";
|
||||||
const storeSession = useSessionStore();
|
const storeSession = useSessionStore();
|
||||||
|
|
||||||
|
storeSession.connect();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="!storeSession.isConnected">
|
<div v-if="!storeSession.isConnected">
|
||||||
Not connected.
|
Not connected.
|
||||||
<button @click="storeSession.login">
|
</div>
|
||||||
Connect!
|
<div v-if="storeSession.isConnected">
|
||||||
</button>
|
Connected as {{ storeSession.session.userId }}.
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -3,6 +3,12 @@ import axios from 'axios';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { Client, Account, ID } from 'appwrite';
|
import { Client, Account, ID } from 'appwrite';
|
||||||
|
|
||||||
|
const appwriteclient = new Client()
|
||||||
|
.setEndpoint('http://ryanpandya.com:8080/v1')
|
||||||
|
.setProject('lifetracker');
|
||||||
|
|
||||||
|
const account = new Account(appwriteclient);
|
||||||
|
|
||||||
export const useSessionStore = defineStore({
|
export const useSessionStore = defineStore({
|
||||||
id: 'sessionState',
|
id: 'sessionState',
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@ -12,12 +18,17 @@ export const useSessionStore = defineStore({
|
|||||||
isConnected: (state) => state.session['userId'] == 'ryan',
|
isConnected: (state) => state.session['userId'] == 'ryan',
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
logout() {
|
||||||
|
const promise = this.account.deleteSession(this.session);
|
||||||
|
var self = this;
|
||||||
|
promise.then(function (response) {
|
||||||
|
self.userId = null; self.email = null; self.session = false;
|
||||||
|
console.log(response); // Success
|
||||||
|
}, function (error) {
|
||||||
|
console.log(error); // Failure
|
||||||
|
});
|
||||||
|
},
|
||||||
connect() {
|
connect() {
|
||||||
const appwriteclient = new Client()
|
|
||||||
.setEndpoint('http://ryanpandya.com:8080/v1')
|
|
||||||
.setProject('lifetracker');
|
|
||||||
|
|
||||||
const account = new Account(appwriteclient);
|
|
||||||
const promise = account.getSession('current');
|
const promise = account.getSession('current');
|
||||||
var session: ISession = {
|
var session: ISession = {
|
||||||
email: '',
|
email: '',
|
||||||
@ -26,26 +37,38 @@ export const useSessionStore = defineStore({
|
|||||||
};
|
};
|
||||||
promise.then(
|
promise.then(
|
||||||
function (response) {
|
function (response) {
|
||||||
response.providerUid;
|
session.email = response.providerUid;
|
||||||
response.userId;
|
session.userId = response.userId;
|
||||||
response.$id;
|
session.id = response.$id;
|
||||||
|
console.log('Connected to existing session');
|
||||||
|
session = session;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
self.email = null;
|
session.email = null;
|
||||||
self.userId = null;
|
session.userId = null;
|
||||||
self.password = null;
|
session.id = null;
|
||||||
self.session = false;
|
console.log('No existing session; starting fresh.');
|
||||||
|
return session;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
login() {
|
login(email : string, password : string) {
|
||||||
const session: ISession = {
|
console.log(this.session);
|
||||||
id: 'moot',
|
const promise = account.createEmailSession(email, password);
|
||||||
userId: 'ryan',
|
var session: ISession = {
|
||||||
email: 'ryan@ryanpandya.com',
|
email: '',
|
||||||
|
userId: '',
|
||||||
|
id: '',
|
||||||
};
|
};
|
||||||
this.session = session;
|
promise.then(function (response) {
|
||||||
console.log('Logged in');
|
session.email = response.providerUid;
|
||||||
|
session.userId = response.userId;
|
||||||
|
session.id = response.$id;
|
||||||
|
console.log('Logged in');
|
||||||
|
return session;
|
||||||
|
}, function (error) {
|
||||||
|
console.log('Error');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useSessionStore } from "../stores/session";
|
||||||
|
const storeSession = useSessionStore();
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var email; var userId; var password; var session;
|
var email; var userId; var password; var session;
|
||||||
export default {
|
export default {
|
||||||
mounted(){},
|
mounted(){
|
||||||
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@ -9,53 +15,29 @@ export default {
|
|||||||
password: password,
|
password: password,
|
||||||
error: null,
|
error: null,
|
||||||
session: session,
|
session: session,
|
||||||
account: account
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
connect() {
|
connect() {
|
||||||
const promise = this.account.createEmailSession(this.email, this.password);
|
console.log("Legacy method called.");
|
||||||
|
|
||||||
var self = this;
|
|
||||||
promise.then(function (response) {
|
|
||||||
self.session = response;
|
|
||||||
self.userId = response.userId;
|
|
||||||
self.error = false;
|
|
||||||
|
|
||||||
}, function (error) {
|
|
||||||
self.session = false;
|
|
||||||
self.error = error;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
logout() {
|
|
||||||
|
|
||||||
|
|
||||||
const promise = this.account.deleteSession(this.session);
|
|
||||||
var self = this;
|
|
||||||
promise.then(function (response) {
|
|
||||||
self.userId = null; self.email = null; self.session = false;
|
|
||||||
console.log(response); // Success
|
|
||||||
}, function (error) {
|
|
||||||
console.log(error); // Failure
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-if="session == null">
|
<div v-if="storeSession.session == null">
|
||||||
Loading...
|
Loading...
|
||||||
</div>
|
</div>
|
||||||
<div v-if="session==false" id="form">
|
<div v-if="storeSession.session == false" id="form">
|
||||||
<h2>Not connected yet.</h2>
|
<h2>Not connected yet.</h2>
|
||||||
<div id="login">
|
<div id="login">
|
||||||
<input name="email" type="text" v-model="email" placeholder="email" />
|
<input name="email" type="text" v-model="email" placeholder="email" />
|
||||||
<input name="password" type="password" v-model="password" placeholder="password"/>
|
<input name="password" type="password" v-model="password" placeholder="password"/>
|
||||||
<button @click="connect">Connect to database</button>
|
<button @click="storeSession.login(email, password)">Connect to database</button>
|
||||||
<h3 class="error" v-if="error">{{ error }}</h3>
|
<h3 class="error" v-if="error">{{ error }}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="session">
|
<div v-if="storeSession.session.id">
|
||||||
<h2>Welcome back, {{ userId }}!</h2>
|
<h2>Welcome back, {{ userId }}!</h2>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<button @click="logout">Log Out</button>
|
<button @click="logout">Log Out</button>
|
||||||
|
|||||||
47
package-lock.json
generated
47
package-lock.json
generated
@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "ltx",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"dependencies": {
|
|
||||||
"node": "^20.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node": {
|
|
||||||
"version": "20.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node/-/node-20.0.0.tgz",
|
|
||||||
"integrity": "sha512-4R1vw5hKUjQw3x65x9g/ape/XlY/ZFHaQWB+jQLFJIJkVKJPDSY4oj3O6qgXOvv2wwgEpK9J2SvJUjuL6zu0uA==",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"dependencies": {
|
|
||||||
"node-bin-setup": "^1.0.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"node": "bin/node"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"npm": ">=5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-bin-setup": {
|
|
||||||
"version": "1.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
|
|
||||||
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg=="
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"node": {
|
|
||||||
"version": "20.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node/-/node-20.0.0.tgz",
|
|
||||||
"integrity": "sha512-4R1vw5hKUjQw3x65x9g/ape/XlY/ZFHaQWB+jQLFJIJkVKJPDSY4oj3O6qgXOvv2wwgEpK9J2SvJUjuL6zu0uA==",
|
|
||||||
"requires": {
|
|
||||||
"node-bin-setup": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node-bin-setup": {
|
|
||||||
"version": "1.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
|
|
||||||
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"node": "^20.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user