casdoor / casdoor-vue-sdk Goto Github PK
View Code? Open in Web Editor NEWVue client SDK for Casdoor
Home Page: https://github.com/casdoor/casdoor
License: Apache License 2.0
Vue client SDK for Casdoor
Home Page: https://github.com/casdoor/casdoor
License: Apache License 2.0
Hi,
I am not sure if I am doing something wrong or there is a bug.
I want to use it with nuxt 3.
I created a filte "casdoor.ts" under plugins folder with following lines of code (modified):
`import Casdoor from 'casdoor-vue-sdk'
const config = {
serverUrl: "https://casdoor.devandy.de",
clientId: "xxx",
organizationName: "xxx",
appName: "xxx",
redirectPath: "/callback",
requireHttpsMetadata: false
};
export default defineNuxtPlugin(async nuxtApp => {
nuxtApp.vueApp.use(Casdoor, config)
})
And under **composables**:
import { useCasdoor } from 'casdoor-vue-sdk';
export default {
setup() {
const { getSigninUrl, getSignupUrl } = useCasdoor();
function login() {
window.location.href = getSigninUrl();
}
function signup() {
window.location.href = getSignupUrl();
}
return {
login,
signup
}
}
}`
But than I got an JavaScript Error: Failed to load resource: the server responded with a status of 504 (Gateway Timeout)
RequestURL: http://localhost:3000/_nuxt/node_modules/.vite/deps/ufo.js?v=dcaeb125
Should follow: https://github.com/casdoor/casdoor-js-sdk
I update to latest release from 3. March and get the error below. Same happens also happens with a fresh yarn install after deleting node_modules
`
✘ [ERROR] Could not resolve "/home/runner/work/casdoor-vue-sdk/casdoor-vue-sdk/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"
node_modules/casdoor-vue-sdk/src/CasdoorSDK.js:1:30:
1 │ ...asyncToGenerator from "/home/runner/work/casdoor-vue-sdk/casdoor-vue-sdk/node_modules/@babel/runtime/helpers/esm/asyncT...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
✘ [ERROR] Could not resolve "regenerator-runtime/runtime.js"
node_modules/casdoor-vue-sdk/src/CasdoorSDK.js:2:7:
2 │ import "regenerator-runtime/runtime.js";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "regenerator-runtime/runtime.js" as external to exclude it from the bundle,
which will remove this error.
`
I'm sorry for asking again but I'm just stuck.
With importing Casdoor I have these functions to use:
getSignupUrl(), getSigninUrl(), getUserProfileUrl(), getMyProfileUrl(), signin()
But how to check if the user is logged in? Or the user is not deleted in the mean time.
How to check if the current user is authorized to do something?
Can you please provide a real example? Maybe I can help you with that?
I could upload an easy nuxt 3 project connecting to my demo casdoor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.