"use strict";(self.webpackChunkclient=self.webpackChunkclient||[]).push([[9559],{78091:(e,s,t)=>{t.d(s,{A:()=>o});const o=()=>e=>{const s=document.getElementById(e);s&&(s.classList.add("shake"),s.querySelectorAll("input").forEach((e=>e.style.borderColor="red")),setTimeout((()=>{s.classList.remove("shake"),s.querySelectorAll("input").forEach((e=>e.style.borderColor="#ccc"))}),1e3))}},89559:(e,s,t)=>{t.r(s),t.d(s,{default:()=>u});var o=t(89379),r=(t(96166),t(82806)),a=t(65043),n=t(78091),l=t(66580),c=t(9435),i=t(1880),d=t(70579);const u=()=>{const[e,s]=(0,a.useState)({confirPassword:"",password:""}),t=(0,n.A)(),u=(0,l.Zp)(),p=(0,c.A)();return(0,d.jsxs)("main",{className:"login__main",children:[(0,d.jsx)("img",{src:r,alt:"Logo.png",className:"mb-5"}),(0,d.jsxs)("div",{className:"login__box flex flex-col",id:"loginBox",children:[(0,d.jsx)("h1",{className:"text-center text-[25px] mb-8 mt-4",children:"Change Password"}),(0,d.jsxs)("form",{onSubmit:async s=>{s.preventDefault();const o=Object.fromEntries(new FormData(s.target));for(let e of Object.keys(o))if(""===o[e]||void 0===o[e]||null===o[e])return void t("loginBox");if(e.password!==e.confirPassword)return p("Confirm password not match","error");try{const s="https://ezybill.ureshiiweightloss.com/api/v1/user/reset-pass",t=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e.password,token:i.A.get("user-token")})}),o=await t.json();if(200!==t.status||!o.change)return p(o.err,"error");i.A.remove("user-token"),i.A.set("token",o.newToken,{secure:!0}),u("/admin/dashboard")}catch(r){return console.log(r),p("Something went wrong","error")}},children:[(0,d.jsx)("input",{type:"text",name:"text",value:e.password,onChange:t=>s((0,o.A)((0,o.A)({},e),{},{password:t.target.value})),className:"input_style",placeholder:"New password"}),(0,d.jsx)("input",{type:"text",name:"text",value:e.confirPassword,onChange:t=>s((0,o.A)((0,o.A)({},e),{},{confirPassword:t.target.value})),className:"input_style",placeholder:"Confirm password"}),(0,d.jsx)("button",{className:"button_style",children:"Save"})]})]})]})}},96166:()=>{},82806:(e,s,t)=>{e.exports=t.p+"static/media/logo.fad19e63cefd8737e978.png"}}]);
//# sourceMappingURL=9559.268aa737.chunk.js.map