mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-13 10:42:22 +01:00
2 lines
1.5 KiB
JavaScript
Vendored
2 lines
1.5 KiB
JavaScript
Vendored
import{T as v,x as w,c as _,$ as h,K as y,h as N,k as C,f as t,_ as E,l as m,m as I,e as V,j as i,C as S,p as $}from"./app-D4Udf6Mm.js";import{F as k}from"./Form-BGrUTood.js";import{u as K}from"./bus-RVphoWuw.js";/*! 2FAuth version 5.4.1 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const U={__name:"CreateUpdate",props:{groupId:[Number,String]},setup(c){const p=v(),d=$(),l=E(),s=K(),a=c,r=w(()=>a.groupId!=null),o=_(new k({name:""}));h(()=>{l.name=="editGroup"&&(s.editedGroupName?(o.name=s.editedGroupName,s.editedGroupName=void 0):y.get(a.groupId).then(e=>{o.name=e.data.name}))});function f(){r.value?B():g()}async function g(){o.post("/api/v1/groups").then(e=>{p.addOrEdit(e.data),d.push({name:"groups"})})}async function B(){o.put("/api/v1/groups/"+a.groupId).then(e=>{p.addOrEdit(e.data),d.push({name:"groups"})})}return(e,n)=>{const F=m("FormField"),b=m("FormButtons"),G=m("FormWrapper");return I(),N(G,{title:t(r)?e.$t("groups.forms.rename_group"):e.$t("groups.forms.new_group")},{default:C(()=>[V("form",{onSubmit:S(f,["prevent"]),onKeydown:n[1]||(n[1]=u=>t(o).onKeydown(u))},[i(F,{modelValue:t(o).name,"onUpdate:modelValue":n[0]||(n[0]=u=>t(o).name=u),fieldName:"name",fieldError:t(o).errors.get("name"),label:"commons.name",autofocus:""},null,8,["modelValue","fieldError"]),i(b,{submitId:t(r)?"btnEditGroup":"btnCreateGroup",isBusy:t(o).isBusy,caption:t(r)?e.$t("commons.save"):e.$t("commons.create"),showCancelButton:!0,cancelLandingView:"groups"},null,8,["submitId","isBusy","caption"])],32)]),_:1},8,["title"])}}};export{U as default};
|