fix: commit vendored @kuns/zitadel-auth dist (was excluded by dist/ gitignore)
This commit is contained in:
37
vendor/zitadel-auth/dist/svelte.js
vendored
Normal file
37
vendor/zitadel-auth/dist/svelte.js
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
ZitadelAuth
|
||||
} from "./chunk-NFH7JLJM.js";
|
||||
|
||||
// src/adapters/svelte.ts
|
||||
var authInstance = null;
|
||||
function createZitadelHandle(config) {
|
||||
const auth = new ZitadelAuth(config);
|
||||
authInstance = auth;
|
||||
auth.init().then(() => {
|
||||
if (!auth.isAuthenticated && !auth.error) {
|
||||
auth.login();
|
||||
}
|
||||
});
|
||||
return {
|
||||
subscribe: (cb) => {
|
||||
cb({
|
||||
isAuthenticated: auth.isAuthenticated,
|
||||
isLoading: auth.isLoading,
|
||||
user: auth.user,
|
||||
error: auth.error
|
||||
});
|
||||
return auth.onAuthChange(cb);
|
||||
},
|
||||
login: () => auth.login(),
|
||||
logout: () => auth.logout(),
|
||||
fetch: (url, init) => auth.fetch(url, init)
|
||||
};
|
||||
}
|
||||
function getAuth() {
|
||||
if (!authInstance) throw new Error("Call createZitadelHandle() before getAuth()");
|
||||
return authInstance;
|
||||
}
|
||||
export {
|
||||
createZitadelHandle,
|
||||
getAuth
|
||||
};
|
||||
Reference in New Issue
Block a user