@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.4 kB
JavaScript
import{copy as e}from"../../../i18n/copy.mjs";import t from"../../../../utils/errors/lucid-api-error.mjs";import n from"../../utils/create-service-context.mjs";import r from"../../../../utils/services/service-wrapper.mjs";import i from"../../../../services/users/unlink-auth-provider.mjs";import a from"../../middleware/authenticate.mjs";import o from"../../middleware/validate.mjs";import s from"../../middleware/validate-csrf.mjs";import c from"../../openapi/index.mjs";import{controllerSchemas as l}from"../../../../schemas/account.mjs";import{createFactory as u}from"hono/factory";import{describeRoute as d}from"hono-openapi";const f=u().createHandlers(d({description:`Unlinks an auth provider from the authenticated user.`,tags:[`account`],summary:`Unlink Auth Provider`,responses:c.responses({noProperties:!0}),parameters:c.parameters({headers:{csrf:!0},params:l.unlinkAuthProvider.params})}),s,a(),o(`param`,l.unlinkAuthProvider.params),async a=>{let{providerId:o}=a.req.valid(`param`),s=a.get(`auth`),c=n(a),l=await r(i,{transaction:!0,defaultError:{type:`basic`,name:e(`server:core.routes.account.auth.provider.unlink.error.message`),message:e(`server:core.routes.account.auth.provider.unlink.error.message`)}})(c,{auth:s,targetUserId:s.id,providerKey:o});if(l.error)throw new t(l.error);return a.status(204),a.body(null)});export{f as default};
//# sourceMappingURL=unlink-auth-provider.mjs.map