casdoor / casdoor-vue-sdk

Vue client SDK for Casdoor
https://github.com/casdoor/casdoor
Apache License 2.0
15 stars 10 forks source link

feat: Add provide/inject method #12

Closed DevRickLin closed 2 years ago

DevRickLin commented 2 years ago

Summary

Using app.provide to provide the instance of Sdk with key CASDOOR_INJECTION_KEY, then encapsulate inject(CASDOOR_INJECTION_KEY) into useCasdoor.

Usage

const { signin } = useCasdoor();

Relating issue

Fix: https://github.com/casdoor/casdoor-vue-sdk/issues/9

casbin-bot commented 2 years ago

@seriouszyx @ComradeProgrammer @Resulte please review

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

hsluoyz commented 2 years ago

@Nekotoxin plz review

hsluoyz commented 2 years ago

@leo220yuyaodog @imp2002 plz review

imp2002 commented 2 years ago

@DevRickLin Could you help add a use example in README?

Such as a example use useCasdoor() in setup(), use Vue3 Composition API that inconvenient to use this to access vue instance.

setup() {
  ...
  const casdoor = useCasdoor()
  // use the casdoor
  ...
}
DevRickLin commented 2 years ago

@DevRickLin Could you help add a use example in README?

Such as a example use useCasdoor() in setup(), use Vue3 Composition API that inconvenient to use this to access vue instance.


setup() {

  ...

  const casdoor = useCasdoor()

  // use the casdoor

  ...

}

I am working on it.

DevRickLin commented 2 years ago

@DevRickLin Could you help add a use example in README?

Such as a example use useCasdoor() in setup(), use Vue3 Composition API that inconvenient to use this to access vue instance.

setup() {
  ...
  const casdoor = useCasdoor()
  // use the casdoor
  ...
}

@imp2002 I have added the example and some explanations to README.

hsluoyz commented 2 years ago

@imp2002

imp2002 commented 2 years ago

LGTM

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 1.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: