From ca0005caaa5cc33f0d840c0009faf6a0ce0bb129 Mon Sep 17 00:00:00 2001 From: omkieit Date: Wed, 4 Sep 2024 11:23:00 +0530 Subject: [PATCH] done --- ef-api/package-lock.json | 5 +++++ ef-api/package.json | 1 + .../assets/{index-Ckttlw5i.js => index-DMRb3R0-.js} | 2 +- ef-ui/dist/index.html | 2 +- ef-ui/src/redux/api.js | 2 +- ef-ui/vite.config.js | 11 +++++++---- 6 files changed, 16 insertions(+), 7 deletions(-) rename ef-ui/dist/assets/{index-Ckttlw5i.js => index-DMRb3R0-.js} (99%) diff --git a/ef-api/package-lock.json b/ef-api/package-lock.json index cc93af9..3ca0c5b 100644 --- a/ef-api/package-lock.json +++ b/ef-api/package-lock.json @@ -12,6 +12,7 @@ "bcryptjs": "^2.4.3", "cors": "^2.8.5", "dotenv": "^16.4.5", + "ef-api": "file:", "express": "^4.19.2", "express-session": "^1.18.0", "jsonwebtoken": "^9.0.2", @@ -275,6 +276,10 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, + "node_modules/ef-api": { + "resolved": "", + "link": true + }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", diff --git a/ef-api/package.json b/ef-api/package.json index 09dbfbc..d093210 100644 --- a/ef-api/package.json +++ b/ef-api/package.json @@ -14,6 +14,7 @@ "bcryptjs": "^2.4.3", "cors": "^2.8.5", "dotenv": "^16.4.5", + "ef-api": "file:", "express": "^4.19.2", "express-session": "^1.18.0", "jsonwebtoken": "^9.0.2", diff --git a/ef-ui/dist/assets/index-Ckttlw5i.js b/ef-ui/dist/assets/index-DMRb3R0-.js similarity index 99% rename from ef-ui/dist/assets/index-Ckttlw5i.js rename to ef-ui/dist/assets/index-DMRb3R0-.js index 372a5ea..1916d1c 100644 --- a/ef-ui/dist/assets/index-Ckttlw5i.js +++ b/ef-ui/dist/assets/index-DMRb3R0-.js @@ -50,7 +50,7 @@ Error generating stack: `+l.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[zc]=this[zc]={accessors:{}}).accessors,i=this.prototype;function l(o){const s=mr(o);r[s]||(vg(i,o),r[s]=!0)}return S.isArray(t)?t.forEach(l):l(t),this}}_e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);S.reduceDescriptors(_e.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});S.freezeMethods(_e);function Bo(e,t){const n=this||oi,r=t||n,i=_e.from(r.headers);let l=r.data;return S.forEach(e,function(s){l=s.call(n,l,i.normalize(),t?t.status:void 0)}),i.normalize(),l}function Vm(e){return!!(e&&e.__CANCEL__)}function tr(e,t,n){L.call(this,e??"canceled",L.ERR_CANCELED,t,n),this.name="CanceledError"}S.inherits(tr,L,{__CANCEL__:!0});function Qm(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function yg(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function gg(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,l=0,o;return t=t!==void 0?t:1e3,function(a){const c=Date.now(),d=r[l];o||(o=c),n[i]=a,r[i]=c;let f=l,v=0;for(;f!==i;)v+=n[f++],f=f%e;if(i=(i+1)%e,i===l&&(l=(l+1)%e),c-o{n=d,i=null,l&&(clearTimeout(l),l=null),e.apply(null,c)};return[(...c)=>{const d=Date.now(),f=d-n;f>=r?o(c,d):(i=c,l||(l=setTimeout(()=>{l=null,o(i)},r-f)))},()=>i&&o(i)]}const El=(e,t,n=3)=>{let r=0;const i=gg(50,250);return xg(l=>{const o=l.loaded,s=l.lengthComputable?l.total:void 0,a=o-r,c=i(a),d=o<=s;r=o;const f={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&d?(s-o)/c:void 0,event:l,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(f)},n)},Mc=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ac=e=>(...t)=>S.asap(()=>e(...t)),wg=ke.hasStandardBrowserEnv?function(){const t=ke.navigator&&/(msie|trident)/i.test(ke.navigator.userAgent),n=document.createElement("a");let r;function i(l){let o=l;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=i(window.location.href),function(o){const s=S.isString(o)?i(o):o;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}(),Ng=ke.hasStandardBrowserEnv?{write(e,t,n,r,i,l){const o=[e+"="+encodeURIComponent(t)];S.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),S.isString(r)&&o.push("path="+r),S.isString(i)&&o.push("domain="+i),l===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Sg(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Eg(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Km(e,t){return e&&!Sg(t)?Eg(e,t):t}const Fc=e=>e instanceof _e?{...e}:e;function mn(e,t){t=t||{};const n={};function r(c,d,f){return S.isPlainObject(c)&&S.isPlainObject(d)?S.merge.call({caseless:f},c,d):S.isPlainObject(d)?S.merge({},d):S.isArray(d)?d.slice():d}function i(c,d,f){if(S.isUndefined(d)){if(!S.isUndefined(c))return r(void 0,c,f)}else return r(c,d,f)}function l(c,d){if(!S.isUndefined(d))return r(void 0,d)}function o(c,d){if(S.isUndefined(d)){if(!S.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function s(c,d,f){if(f in t)return r(c,d);if(f in e)return r(void 0,c)}const a={url:l,method:l,data:l,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(c,d)=>i(Fc(c),Fc(d),!0)};return S.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=a[d]||i,v=f(e[d],t[d],d);S.isUndefined(v)&&f!==s||(n[d]=v)}),n}const qm=e=>{const t=mn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:l,headers:o,auth:s}=t;t.headers=o=_e.from(o),t.url=$m(Km(t.baseURL,t.url),e.params,e.paramsSerializer),s&&o.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let a;if(S.isFormData(n)){if(ke.hasStandardBrowserEnv||ke.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((a=o.getContentType())!==!1){const[c,...d]=a?a.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...d].join("; "))}}if(ke.hasStandardBrowserEnv&&(r&&S.isFunction(r)&&(r=r(t)),r||r!==!1&&wg(t.url))){const c=i&&l&&Ng.read(l);c&&o.set(i,c)}return t},kg=typeof XMLHttpRequest<"u",_g=kg&&function(e){return new Promise(function(n,r){const i=qm(e);let l=i.data;const o=_e.from(i.headers).normalize();let{responseType:s,onUploadProgress:a,onDownloadProgress:c}=i,d,f,v,x,y;function g(){x&&x(),y&&y(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let N=new XMLHttpRequest;N.open(i.method.toUpperCase(),i.url,!0),N.timeout=i.timeout;function p(){if(!N)return;const h=_e.from("getAllResponseHeaders"in N&&N.getAllResponseHeaders()),k={data:!s||s==="text"||s==="json"?N.responseText:N.response,status:N.status,statusText:N.statusText,headers:h,config:e,request:N};Qm(function(O){n(O),g()},function(O){r(O),g()},k),N=null}"onloadend"in N?N.onloadend=p:N.onreadystatechange=function(){!N||N.readyState!==4||N.status===0&&!(N.responseURL&&N.responseURL.indexOf("file:")===0)||setTimeout(p)},N.onabort=function(){N&&(r(new L("Request aborted",L.ECONNABORTED,e,N)),N=null)},N.onerror=function(){r(new L("Network Error",L.ERR_NETWORK,e,N)),N=null},N.ontimeout=function(){let w=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const k=i.transitional||Wm;i.timeoutErrorMessage&&(w=i.timeoutErrorMessage),r(new L(w,k.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,N)),N=null},l===void 0&&o.setContentType(null),"setRequestHeader"in N&&S.forEach(o.toJSON(),function(w,k){N.setRequestHeader(k,w)}),S.isUndefined(i.withCredentials)||(N.withCredentials=!!i.withCredentials),s&&s!=="json"&&(N.responseType=i.responseType),c&&([v,y]=El(c,!0),N.addEventListener("progress",v)),a&&N.upload&&([f,x]=El(a),N.upload.addEventListener("progress",f),N.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(d=h=>{N&&(r(!h||h.type?new tr(null,e,N):h),N.abort(),N=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const m=yg(i.url);if(m&&ke.protocols.indexOf(m)===-1){r(new L("Unsupported protocol "+m+":",L.ERR_BAD_REQUEST,e));return}N.send(l||null)})},jg=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const l=function(c){if(!i){i=!0,s();const d=c instanceof Error?c:this.reason;r.abort(d instanceof L?d:new tr(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,l(new L(`timeout ${t} of ms exceeded`,L.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(l):c.removeEventListener("abort",l)}),e=null)};e.forEach(c=>c.addEventListener("abort",l));const{signal:a}=r;return a.unsubscribe=()=>S.asap(s),a}},Cg=function*(e,t){let n=e.byteLength;if(!t||n{const i=Og(e,t);let l=0,o,s=a=>{o||(o=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:c,value:d}=await i.next();if(c){s(),a.close();return}let f=d.byteLength;if(n){let v=l+=f;n(v)}a.enqueue(new Uint8Array(d))}catch(c){throw s(c),c}},cancel(a){return s(a),i.return()}},{highWaterMark:2})},eo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Jm=eo&&typeof ReadableStream=="function",Rg=eo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Xm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Tg=Jm&&Xm(()=>{let e=!1;const t=new Request(ke.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ic=64*1024,Qs=Jm&&Xm(()=>S.isReadableStream(new Response("").body)),kl={stream:Qs&&(e=>e.body)};eo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!kl[t]&&(kl[t]=S.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new L(`Response type '${t}' is not supported`,L.ERR_NOT_SUPPORT,r)})})})(new Response);const Lg=async e=>{if(e==null)return 0;if(S.isBlob(e))return e.size;if(S.isSpecCompliantForm(e))return(await new Request(ke.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(S.isArrayBufferView(e)||S.isArrayBuffer(e))return e.byteLength;if(S.isURLSearchParams(e)&&(e=e+""),S.isString(e))return(await Rg(e)).byteLength},zg=async(e,t)=>{const n=S.toFiniteNumber(e.getContentLength());return n??Lg(t)},Mg=eo&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:l,timeout:o,onDownloadProgress:s,onUploadProgress:a,responseType:c,headers:d,withCredentials:f="same-origin",fetchOptions:v}=qm(e);c=c?(c+"").toLowerCase():"text";let x=jg([i,l&&l.toAbortSignal()],o),y;const g=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let N;try{if(a&&Tg&&n!=="get"&&n!=="head"&&(N=await zg(d,r))!==0){let k=new Request(t,{method:"POST",body:r,duplex:"half"}),j;if(S.isFormData(r)&&(j=k.headers.get("content-type"))&&d.setContentType(j),k.body){const[O,C]=Mc(N,El(Ac(a)));r=Dc(k.body,Ic,O,C)}}S.isString(f)||(f=f?"include":"omit");const p="credentials"in Request.prototype;y=new Request(t,{...v,signal:x,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:p?f:void 0});let m=await fetch(y);const h=Qs&&(c==="stream"||c==="response");if(Qs&&(s||h&&g)){const k={};["status","statusText","headers"].forEach(D=>{k[D]=m[D]});const j=S.toFiniteNumber(m.headers.get("content-length")),[O,C]=s&&Mc(j,El(Ac(s),!0))||[];m=new Response(Dc(m.body,Ic,O,()=>{C&&C(),g&&g()}),k)}c=c||"text";let w=await kl[S.findKey(kl,c)||"text"](m,e);return!h&&g&&g(),await new Promise((k,j)=>{Qm(k,j,{data:w,headers:_e.from(m.headers),status:m.status,statusText:m.statusText,config:e,request:y})})}catch(p){throw g&&g(),p&&p.name==="TypeError"&&/fetch/i.test(p.message)?Object.assign(new L("Network Error",L.ERR_NETWORK,e,y),{cause:p.cause||p}):L.from(p,p&&p.code,e,y)}}),Ks={http:Jy,xhr:_g,fetch:Mg};S.forEach(Ks,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Uc=e=>`- ${e}`,Ag=e=>S.isFunction(e)||e===null||e===!1,Gm={getAdapter:e=>{e=S.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let l=0;l`adapter ${s} `+(a===!1?"is not supported by the environment":"is not available in the build"));let o=t?l.length>1?`since : `+l.map(Uc).join(` `):" "+Uc(l[0]):"as no adapter specified";throw new L("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Ks};function $o(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new tr(null,e)}function bc(e){return $o(e),e.headers=_e.from(e.headers),e.data=Bo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Gm.getAdapter(e.adapter||oi.adapter)(e).then(function(r){return $o(e),r.data=Bo.call(e,e.transformResponse,r),r.headers=_e.from(r.headers),r},function(r){return Vm(r)||($o(e),r&&r.response&&(r.response.data=Bo.call(e,e.transformResponse,r.response),r.response.headers=_e.from(r.response.headers))),Promise.reject(r)})}const Ym="1.7.7",tu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Bc={};tu.transitional=function(t,n,r){function i(l,o){return"[Axios v"+Ym+"] Transitional option '"+l+"'"+o+(r?". "+r:"")}return(l,o,s)=>{if(t===!1)throw new L(i(o," has been removed"+(n?" in "+n:"")),L.ERR_DEPRECATED);return n&&!Bc[o]&&(Bc[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(l,o,s):!0}};function Fg(e,t,n){if(typeof e!="object")throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const l=r[i],o=t[l];if(o){const s=e[l],a=s===void 0||o(s,l,e);if(a!==!0)throw new L("option "+l+" must be "+a,L.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new L("Unknown option "+l,L.ERR_BAD_OPTION)}}const qs={assertOptions:Fg,validators:tu},gt=qs.validators;class ln{constructor(t){this.defaults=t,this.interceptors={request:new Lc,response:new Lc}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const l=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=mn(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:l}=n;r!==void 0&&qs.assertOptions(r,{silentJSONParsing:gt.transitional(gt.boolean),forcedJSONParsing:gt.transitional(gt.boolean),clarifyTimeoutError:gt.transitional(gt.boolean)},!1),i!=null&&(S.isFunction(i)?n.paramsSerializer={serialize:i}:qs.assertOptions(i,{encode:gt.function,serialize:gt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=l&&S.merge(l.common,l[n.method]);l&&S.forEach(["delete","get","head","post","put","patch","common"],y=>{delete l[y]}),n.headers=_e.concat(o,l);const s=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(a=a&&g.synchronous,s.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let d,f=0,v;if(!a){const y=[bc.bind(this),void 0];for(y.unshift.apply(y,s),y.push.apply(y,c),v=y.length,d=Promise.resolve(n);f{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l;const o=new Promise(s=>{r.subscribe(s),l=s}).then(i);return o.cancel=function(){r.unsubscribe(l)},o},t(function(l,o,s){r.reason||(r.reason=new tr(l,o,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new nu(function(i){t=i}),cancel:t}}}function Dg(e){return function(n){return e.apply(null,n)}}function Ig(e){return S.isObject(e)&&e.isAxiosError===!0}const Js={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Js).forEach(([e,t])=>{Js[t]=e});function Zm(e){const t=new ln(e),n=Rm(ln.prototype.request,t);return S.extend(n,ln.prototype,t,{allOwnKeys:!0}),S.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Zm(mn(e,i))},n}const Z=Zm(oi);Z.Axios=ln;Z.CanceledError=tr;Z.CancelToken=nu;Z.isCancel=Vm;Z.VERSION=Ym;Z.toFormData=Zl;Z.AxiosError=L;Z.Cancel=Z.CanceledError;Z.all=function(t){return Promise.all(t)};Z.spread=Dg;Z.isAxiosError=Ig;Z.mergeConfig=mn;Z.AxiosHeaders=_e;Z.formToJSON=e=>Hm(S.isHTMLForm(e)?new FormData(e):e);Z.getAdapter=Gm.getAdapter;Z.HttpStatusCode=Js;Z.default=Z;const Ug=void 0,ru=Z.create({baseURL:Ug});ru.interceptors.request.use(e=>(localStorage.getItem("profile")&&(e.headers.Authorization=`Bearer ${JSON.parse(localStorage.getItem("profile")).token}`),e));const bg=e=>ru.post("/users/signup",e),Bg=e=>ru.post("/users/signin",e),Qi=Pm("auth/register",async({formValue:e,navigate:t,toast:n},{rejectWithValue:r})=>{try{const i=await bg(e);return n.success("Register Successfully"),t("/"),i.data}catch(i){return r(i.response.data)}}),Ki=Pm("auth/login",async({formValue:e,navigate:t,toast:n},{rejectWithValue:r})=>{try{const i=await Bg(e);return n.success("Login Successfully"),t("/register"),i.data}catch(i){return r(i.response.data)}}),ep=iy({name:"auth",initialState:{user:null,error:null,loading:!1},reducers:{setUser:(e,t)=>{e.user=t.payload},setLogout:e=>{localStorage.clear(),e.user=null},setUserDetails:(e,t)=>{e.user=t.payload}},extraReducers:e=>{e.addCase(Qi.pending,(t,n)=>{t.loading=!0,t.user=n.payload}).addCase(Qi.fulfilled,(t,n)=>{t.loading=!1,t.error=null,localStorage.setItem("profile",JSON.stringify({...n.payload})),t.user=n.payload}).addCase(Qi.rejected,(t,n)=>{t.loading=!1,t.error=n.payload}).addCase(Ki.pending,t=>{t.loading=!0}).addCase(Ki.fulfilled,(t,n)=>{t.loading=!1,localStorage.setItem("profile",JSON.stringify({...n.payload})),t.user=n.payload}).addCase(Ki.rejected,(t,n)=>{t.loading=!1,t.error=n.payload})}});ep.actions;const $g=ep.reducer,Wg=Wv({reducer:{auth:$g}});/** +`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=mn(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:l}=n;r!==void 0&&qs.assertOptions(r,{silentJSONParsing:gt.transitional(gt.boolean),forcedJSONParsing:gt.transitional(gt.boolean),clarifyTimeoutError:gt.transitional(gt.boolean)},!1),i!=null&&(S.isFunction(i)?n.paramsSerializer={serialize:i}:qs.assertOptions(i,{encode:gt.function,serialize:gt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=l&&S.merge(l.common,l[n.method]);l&&S.forEach(["delete","get","head","post","put","patch","common"],y=>{delete l[y]}),n.headers=_e.concat(o,l);const s=[];let a=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(a=a&&g.synchronous,s.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let d,f=0,v;if(!a){const y=[bc.bind(this),void 0];for(y.unshift.apply(y,s),y.push.apply(y,c),v=y.length,d=Promise.resolve(n);f{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l;const o=new Promise(s=>{r.subscribe(s),l=s}).then(i);return o.cancel=function(){r.unsubscribe(l)},o},t(function(l,o,s){r.reason||(r.reason=new tr(l,o,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new nu(function(i){t=i}),cancel:t}}}function Dg(e){return function(n){return e.apply(null,n)}}function Ig(e){return S.isObject(e)&&e.isAxiosError===!0}const Js={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Js).forEach(([e,t])=>{Js[t]=e});function Zm(e){const t=new ln(e),n=Rm(ln.prototype.request,t);return S.extend(n,ln.prototype,t,{allOwnKeys:!0}),S.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Zm(mn(e,i))},n}const Z=Zm(oi);Z.Axios=ln;Z.CanceledError=tr;Z.CancelToken=nu;Z.isCancel=Vm;Z.VERSION=Ym;Z.toFormData=Zl;Z.AxiosError=L;Z.Cancel=Z.CanceledError;Z.all=function(t){return Promise.all(t)};Z.spread=Dg;Z.isAxiosError=Ig;Z.mergeConfig=mn;Z.AxiosHeaders=_e;Z.formToJSON=e=>Hm(S.isHTMLForm(e)?new FormData(e):e);Z.getAdapter=Gm.getAdapter;Z.HttpStatusCode=Js;Z.default=Z;const Ug="http://67.225.129.127:81",ru=Z.create({baseURL:Ug});ru.interceptors.request.use(e=>(localStorage.getItem("profile")&&(e.headers.Authorization=`Bearer ${JSON.parse(localStorage.getItem("profile")).token}`),e));const bg=e=>ru.post("/users/signup",e),Bg=e=>ru.post("/users/signin",e),Qi=Pm("auth/register",async({formValue:e,navigate:t,toast:n},{rejectWithValue:r})=>{try{const i=await bg(e);return n.success("Register Successfully"),t("/"),i.data}catch(i){return r(i.response.data)}}),Ki=Pm("auth/login",async({formValue:e,navigate:t,toast:n},{rejectWithValue:r})=>{try{const i=await Bg(e);return n.success("Login Successfully"),t("/register"),i.data}catch(i){return r(i.response.data)}}),ep=iy({name:"auth",initialState:{user:null,error:null,loading:!1},reducers:{setUser:(e,t)=>{e.user=t.payload},setLogout:e=>{localStorage.clear(),e.user=null},setUserDetails:(e,t)=>{e.user=t.payload}},extraReducers:e=>{e.addCase(Qi.pending,(t,n)=>{t.loading=!0,t.user=n.payload}).addCase(Qi.fulfilled,(t,n)=>{t.loading=!1,t.error=null,localStorage.setItem("profile",JSON.stringify({...n.payload})),t.user=n.payload}).addCase(Qi.rejected,(t,n)=>{t.loading=!1,t.error=n.payload}).addCase(Ki.pending,t=>{t.loading=!0}).addCase(Ki.fulfilled,(t,n)=>{t.loading=!1,localStorage.setItem("profile",JSON.stringify({...n.payload})),t.user=n.payload}).addCase(Ki.rejected,(t,n)=>{t.loading=!1,t.error=n.payload})}});ep.actions;const $g=ep.reducer,Wg=Wv({reducer:{auth:$g}});/** * @remix-run/router v1.19.1 * * Copyright (c) Remix Software Inc. diff --git a/ef-ui/dist/index.html b/ef-ui/dist/index.html index e2dca1d..9d44a4a 100644 --- a/ef-ui/dist/index.html +++ b/ef-ui/dist/index.html @@ -27,7 +27,7 @@ - + diff --git a/ef-ui/src/redux/api.js b/ef-ui/src/redux/api.js index ea3ea9c..fb11aae 100644 --- a/ef-ui/src/redux/api.js +++ b/ef-ui/src/redux/api.js @@ -1,6 +1,6 @@ import axios from "axios"; -const BASE_URL = import.meta.env.REACT_APP_SECRET; +const BASE_URL = import.meta.env.VITE_REACT_APP_SECRET; // const API = axios.create({baseURL:"http://localhost:3001"}); // const API = axios.create({ baseURL: `${BASE_URL}` }); diff --git a/ef-ui/vite.config.js b/ef-ui/vite.config.js index 5dac28b..fe8d684 100644 --- a/ef-ui/vite.config.js +++ b/ef-ui/vite.config.js @@ -1,7 +1,7 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' - - +// const BASE_URL = import.meta.env.VITE_REACT_APP_SECRET; +// console.log("Base URL:", BASE_URL); // https://vitejs.dev/config/ export default defineConfig({ @@ -9,8 +9,11 @@ export default defineConfig({ server: { proxy: { - '/users/signup': 'http://localhost:3001', // Proxy requests to /users to the backend server - '/users/signin': 'http://localhost:3001', + // '/users/signup': BASE_URL || 'http://localhost:3002', + // '/users/signin': BASE_URL || 'http://localhost:3002', + + '/users/signup': 'http://67.225.129.127:81', // Fallback if BASE_URL is undefined + '/users/signin': 'http://67.225.129.127:81', }, },