@logto/vue 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -72
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
[](https://github.com/logto-io/js/actions/workflows/main.yml)
|
|
4
4
|
[](https://app.codecov.io/gh/logto-io/js?branch=master)
|
|
5
5
|
|
|
6
|
-
The Logto Vue SDK written in TypeScript. Check out our [integration guide](https://docs.logto.io/integrate-
|
|
6
|
+
The Logto Vue SDK written in TypeScript. Check out our [integration guide](https://docs.logto.io/docs/recipes/integrate-logto/vue) or [docs](https://docs.logto.io/sdk/JavaScript/vue/) for more information.
|
|
7
7
|
|
|
8
|
-
We also provide [集成指南](https://docs.logto.io/zh-cn/integrate-
|
|
8
|
+
We also provide [集成指南](https://docs.logto.io/zh-cn/docs/recipes/integrate-logto/vue/) and [文档](https://docs.logto.io/zh-cn/sdk/JavaScript/vue/) in Simplified Chinese.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -24,86 +24,21 @@ yarn add @logto/vue
|
|
|
24
24
|
### Using pnpm
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
pnpm
|
|
27
|
+
pnpm add @logto/vue
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
## Get sample
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
<script src="https://logto.io/js/logto-sdk-vue/0.1.0/logto-sdk-vue.production.js" />
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Get Started
|
|
37
|
-
|
|
38
|
-
A sample project with the following code snippets can be found at [Vue Sample](https://github.com/logto-io/js/tree/master/packages/vue-sample)
|
|
39
|
-
|
|
40
|
-
Check out the source code and try it yourself. (We use [pnpm](https://pnpm.io/) for package management)
|
|
32
|
+
A sample Vue project with the integration of @logto/vue SDK can be found at [Vue Sample](https://github.com/logto-io/js/tree/master/packages/vue-sample). Check out the source code and try it with ease.
|
|
41
33
|
|
|
42
34
|
```bash
|
|
43
35
|
pnpm i && pnpm start
|
|
44
36
|
```
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { createLogto, LogtoConfig } from '@logto/vue';
|
|
50
|
-
|
|
51
|
-
const config: LogtoConfig = {
|
|
52
|
-
appId: '<your-application-id>',
|
|
53
|
-
endpoint: '<your-logto-endpoint>'
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const app = createApp(App);
|
|
57
|
-
|
|
58
|
-
app.use(createLogto, config);
|
|
59
|
-
app.mount("#app");
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Setup your sign-in
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
import { useLogto } from "@logto/vue";
|
|
66
|
-
|
|
67
|
-
const { signIn } = useLogto();
|
|
68
|
-
const onClickSignIn = () => signIn(redirectUrl);
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
```html
|
|
72
|
-
<button @click="onClickSignIn">Sign In</button>
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Retrieve Auth Status
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
import { useLogto } from '@logto/vue';
|
|
79
|
-
|
|
80
|
-
const { isAuthenticated } = useLogto();
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```html
|
|
84
|
-
<div v-if="!isAuthenticated">
|
|
85
|
-
<!-- E.g. navigate to the sign in page -->
|
|
86
|
-
</div>
|
|
87
|
-
<div v-else>
|
|
88
|
-
<!-- Do things when user is authenticated -->
|
|
89
|
-
</div>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Sign out
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
import { useLogto } from "@logto/vue";
|
|
96
|
-
|
|
97
|
-
const { signOut } = useLogto();
|
|
98
|
-
const onClickSignOut = () => signOut('http://localhost:1234');
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
```html
|
|
102
|
-
<button @click="onClickSignOut">Sign Out</button>
|
|
103
|
-
```
|
|
38
|
+
Note: Currently only supports Vue 3.x and its [composition API](https://vuejs.org/api/composition-api-setup.html#composition-api-setup). Please let us know if you would like Logto to support Vue 2.x or options API by filing a [feature request](https://github.com/logto-io/logto/issues/new?assignees=&labels=feature-request&template=feature_request.md&title=feature+request%3A+).
|
|
104
39
|
|
|
105
40
|
## Resources
|
|
106
41
|
|
|
107
42
|
[](https://logto.io/)
|
|
108
|
-
[](https://docs.logto.io/
|
|
43
|
+
[](https://docs.logto.io/sdk/JavaScript/vue/)
|
|
109
44
|
[](https://discord.gg/UEPaF3j5e6)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/vue",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"source": "./src/index.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"prepack": "pnpm test"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@logto/browser": "^1.0.0-beta.
|
|
32
|
+
"@logto/browser": "^1.0.0-beta.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jest/types": "^27.5.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "212891497b04e3a5fd6b24bbbeec227dfec8ae53"
|
|
74
74
|
}
|