UNPKG

@ctx-core/auth0-cs-solid

Version:

Auth0 solid-js components & ctx-core integration for client-server multipage apps & font-end single page web apps

27 lines (26 loc) 773 B
import { auth0__close, auth0__oauth_token__POST__fetch2, auth0__token__error__logout, auth0__token__error__set, auth0__token__json__set, password_realm__body_ } from '@ctx-core/auth0' import { auth0__body__login_ } from '../auth0__body__login_/index.js' export const login = async (ctx, data, schedule_forms_clear = ()=>{ })=>{ const [json, response] = await auth0__oauth_token__POST__fetch2( ctx, password_realm__body_(ctx, auth0__body__login_(ctx, data))) if (response.ok) { auth0__token__json__set(ctx, JSON.stringify(json)) schedule_forms_clear() auth0__close(ctx) } else { /** @type {import('auth0-js').Auth0Error} */ const auth0_error = json auth0__token__error__set(ctx, auth0_error) auth0__token__error__logout(ctx, auth0_error) } }