From 666dc5b0e0e3c1d276320c45dc5ee40a939793c3 Mon Sep 17 00:00:00 2001 From: Guilherme Baufaker Date: Wed, 24 Apr 2024 12:14:12 -0300 Subject: [PATCH] changed api calls --- actions/adminGetAssociation.ts | 2 +- actions/adminGetAssociationUsers.ts | 6 ++-- actions/adminGetOrders.ts | 6 ++-- actions/adminUpdateAssociation.ts | 2 +- actions/changePassword.ts | 17 +++++++----- actions/changeSubscription.ts | 17 +++++++----- actions/checkout.ts | 15 ++++++---- actions/checkoutv2.ts | 17 +++++++----- actions/cognitoAdminSignIn.ts | 21 ++++++++------ actions/cognitoSignIn.ts | 21 ++++++++------ actions/cognitoSignUp.ts | 25 +++++++++-------- actions/confirmCognitoSignup.ts | 21 ++++++++------ actions/confirmForgotPassword.ts | 2 +- actions/deleteAssociationDocument.ts | 2 +- actions/deleteDocument.ts | 2 +- actions/forgotPassword.ts | 19 +++++++------ actions/getAssociation.ts | 13 +++++---- actions/getAssociationDocs.ts | 2 +- actions/getCardProduct.ts | 13 +++++---- actions/getCids.ts | 15 ++++++---- actions/getDocs.ts | 15 ++++++---- actions/getPlans.ts | 2 +- actions/getProfile.ts | 15 ++++++---- actions/getUser.ts | 15 ++++++---- actions/getUserOrders.ts | 15 ++++++---- actions/resendConfirmationCode.ts | 2 +- actions/updateProfile.ts | 17 +++++++----- actions/updateUserData.ts | 34 +++++++++++++---------- actions/uploadFile.ts | 17 +++++++----- components/ui/AdminNewDocModal.tsx | 6 ++-- components/ui/AssociationAdmin.tsx | 17 +++++++----- components/ui/ChoosePlanSignup.tsx | 2 +- components/ui/MyAccount.tsx | 2 +- components/ui/MyDocs.tsx | 17 +++++++----- components/ui/MyInfo.tsx | 17 +++++++----- components/ui/PrivatePageControl.tsx | 17 +++++++----- components/ui/PrivatePageControlAdmin.tsx | 17 +++++++----- components/ui/PublicPageControl.tsx | 17 +++++++----- components/ui/Signout.tsx | 15 ++++++---- loaders/getPublicProfile.ts | 5 +++- 40 files changed, 296 insertions(+), 206 deletions(-) diff --git a/actions/adminGetAssociation.ts b/actions/adminGetAssociation.ts index a778cb6..400f76a 100644 --- a/actions/adminGetAssociation.ts +++ b/actions/adminGetAssociation.ts @@ -18,7 +18,7 @@ const getAssociation = async ( ): Promise => { try { const response = await fetch( - `http://localhost:3000/associations/admin/${id}`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//associations/admin/${id}`, { method: "GET", headers: { diff --git a/actions/adminGetAssociationUsers.ts b/actions/adminGetAssociationUsers.ts index 38cd99c..37e5130 100644 --- a/actions/adminGetAssociationUsers.ts +++ b/actions/adminGetAssociationUsers.ts @@ -35,13 +35,15 @@ const getAssociation = async ( _req: Request, ): Promise => { try { - let url = `http://localhost:3000/profile/admin`; + let url = + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//profile/admin`; if (params) { const query = `?limit=${params.limit}&page=${params.page}${ params.email && `&email=${params.email}` }`; - url = `http://localhost:3000/profile/admin${query}`; + url = + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//profile/admin${query}`; } const response = await fetch(url, { diff --git a/actions/adminGetOrders.ts b/actions/adminGetOrders.ts index b7236a2..e86caab 100644 --- a/actions/adminGetOrders.ts +++ b/actions/adminGetOrders.ts @@ -52,13 +52,15 @@ const adminGetOrders = async ( { token, params }: Props, _req: Request, ): Promise => { - let url = `http://localhost:3000/admin/orders/`; + let url = + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//admin/orders/`; if (params) { const query = `?limit=${params.limit}&page=${params.page}${ params.status && `&status=${params.status}` }`; - url = `http://localhost:3000/admin/orders${query}`; + url = + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//admin/orders${query}`; } try { diff --git a/actions/adminUpdateAssociation.ts b/actions/adminUpdateAssociation.ts index 5a16e27..0cd53f7 100644 --- a/actions/adminUpdateAssociation.ts +++ b/actions/adminUpdateAssociation.ts @@ -17,7 +17,7 @@ const getAssociation = async ( ): Promise => { try { const response = await fetch( - `http://localhost:3000/associations/admin/${id}`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//associations/admin/${id}`, { method: "PUT", body: JSON.stringify(body), diff --git a/actions/changePassword.ts b/actions/changePassword.ts index 2ecdf52..3acb298 100644 --- a/actions/changePassword.ts +++ b/actions/changePassword.ts @@ -11,14 +11,17 @@ const changePassword = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/change-password", { - method: "PUT", - body: JSON.stringify(body), - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/change-password", + { + method: "PUT", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/changeSubscription.ts b/actions/changeSubscription.ts index e488a1e..57acc4b 100644 --- a/actions/changeSubscription.ts +++ b/actions/changeSubscription.ts @@ -27,14 +27,17 @@ const changeSubscription = async ( const params = { ...props }; delete params.token; try { - const response = await fetch("http://localhost:3000/checkout/upgrade", { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: props.token!, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//checkout/upgrade", + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: props.token!, + }, + body: JSON.stringify({ ...params }), }, - body: JSON.stringify({ ...params }), - }); + ); const res = await response.json(); return res; diff --git a/actions/checkout.ts b/actions/checkout.ts index 6c34c84..0b8eee1 100644 --- a/actions/checkout.ts +++ b/actions/checkout.ts @@ -36,13 +36,16 @@ const checkout = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/checkout", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//checkout", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(props), }, - body: JSON.stringify(props), - }); + ); const res = await response.json(); return res; diff --git a/actions/checkoutv2.ts b/actions/checkoutv2.ts index 7a6665e..ba655a8 100644 --- a/actions/checkoutv2.ts +++ b/actions/checkoutv2.ts @@ -33,14 +33,17 @@ const checkoutv2 = async ( console.log({ params }); try { - const response = await fetch("http://localhost:3000/checkout/v2", { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: props.token || "", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//checkout/v2", + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: props.token || "", + }, + body: JSON.stringify(params), }, - body: JSON.stringify(params), - }); + ); const res = await response.json(); return res; diff --git a/actions/cognitoAdminSignIn.ts b/actions/cognitoAdminSignIn.ts index 71cd906..38335f9 100644 --- a/actions/cognitoAdminSignIn.ts +++ b/actions/cognitoAdminSignIn.ts @@ -8,16 +8,19 @@ const signInCognito = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/admin/sign-in", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//admin/sign-in", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: props.email, + password: props.password, + }), }, - body: JSON.stringify({ - email: props.email, - password: props.password, - }), - }); + ); const res = await response.json(); return res; diff --git a/actions/cognitoSignIn.ts b/actions/cognitoSignIn.ts index 7e194ce..75c4bc5 100644 --- a/actions/cognitoSignIn.ts +++ b/actions/cognitoSignIn.ts @@ -8,16 +8,19 @@ const signInCognito = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/sign-in", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/sign-in", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: props.email, + password: props.password, + }), }, - body: JSON.stringify({ - email: props.email, - password: props.password, - }), - }); + ); const res = await response.json(); return res; diff --git a/actions/cognitoSignUp.ts b/actions/cognitoSignUp.ts index e3d1e1d..5f7f352 100644 --- a/actions/cognitoSignUp.ts +++ b/actions/cognitoSignUp.ts @@ -10,18 +10,21 @@ const signUpCognito = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: props.email, + password: props.password, + name: props.name, + cpf: props.cpf, + }), }, - body: JSON.stringify({ - email: props.email, - password: props.password, - name: props.name, - cpf: props.cpf, - }), - }); + ); const res = await response.json(); return res; diff --git a/actions/confirmCognitoSignup.ts b/actions/confirmCognitoSignup.ts index e160f14..5fd9d27 100644 --- a/actions/confirmCognitoSignup.ts +++ b/actions/confirmCognitoSignup.ts @@ -8,16 +8,19 @@ const confirmCognitoSignup = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/confirm-signup", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/confirm-signup", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: props.email, + code: props.code, + }), }, - body: JSON.stringify({ - email: props.email, - code: props.code, - }), - }); + ); const res = await response.json(); return res; diff --git a/actions/confirmForgotPassword.ts b/actions/confirmForgotPassword.ts index 506995f..90eeded 100644 --- a/actions/confirmForgotPassword.ts +++ b/actions/confirmForgotPassword.ts @@ -10,7 +10,7 @@ const confirmForgotPassword = async ( ): Promise => { try { const response = await fetch( - "http://localhost:3000/auth/forgot-password/confirm", + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/forgot-password/confirm", { method: "POST", headers: { diff --git a/actions/deleteAssociationDocument.ts b/actions/deleteAssociationDocument.ts index d6f947e..adfe07b 100644 --- a/actions/deleteAssociationDocument.ts +++ b/actions/deleteAssociationDocument.ts @@ -10,7 +10,7 @@ const deleteAssociationDocument = async ( console.log({ docId: props.docId }); try { const response = await fetch( - `http://localhost:3000/documents/association/${props.docId}`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents/association/${props.docId}`, { method: "DELETE", headers: { diff --git a/actions/deleteDocument.ts b/actions/deleteDocument.ts index a076a78..159c39d 100644 --- a/actions/deleteDocument.ts +++ b/actions/deleteDocument.ts @@ -10,7 +10,7 @@ const deleteDocument = async ( console.log({ docId: props.docId }); try { const response = await fetch( - `http://localhost:3000/documents/${props.docId}`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents/${props.docId}`, { method: "DELETE", headers: { diff --git a/actions/forgotPassword.ts b/actions/forgotPassword.ts index beb3607..b0ea918 100644 --- a/actions/forgotPassword.ts +++ b/actions/forgotPassword.ts @@ -7,15 +7,18 @@ const forgotPassword = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/forgot-password", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/forgot-password", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + email: props.email, + }), }, - body: JSON.stringify({ - email: props.email, - }), - }); + ); const res = await response.json(); return res; diff --git a/actions/getAssociation.ts b/actions/getAssociation.ts index 246d464..c8c3f67 100644 --- a/actions/getAssociation.ts +++ b/actions/getAssociation.ts @@ -7,12 +7,15 @@ const getAssociation = async ( _req: Request, ): Promise => { try { - const response = await fetch(`http://localhost:3000/associations/${id}`, { - method: "GET", - headers: { - "Content-Type": "application/json", + const response = await fetch( + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//associations/${id}`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getAssociationDocs.ts b/actions/getAssociationDocs.ts index 282938c..70b06d3 100644 --- a/actions/getAssociationDocs.ts +++ b/actions/getAssociationDocs.ts @@ -9,7 +9,7 @@ const getDocs = async ( ): Promise => { try { const response = await fetch( - `http://localhost:3000/documents/association/${associationId}`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents/association/${associationId}`, { method: "GET", headers: { diff --git a/actions/getCardProduct.ts b/actions/getCardProduct.ts index b9225e4..71f9b9a 100644 --- a/actions/getCardProduct.ts +++ b/actions/getCardProduct.ts @@ -1,11 +1,14 @@ const getPlans = async (_req: Request): Promise => { try { - const response = await fetch("http://localhost:3000/products/cards", { - method: "GET", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//products/cards", + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getCids.ts b/actions/getCids.ts index 669525c..9813705 100644 --- a/actions/getCids.ts +++ b/actions/getCids.ts @@ -8,13 +8,16 @@ const getCids = async ( _req: Request, ): Promise => { try { - const response = await fetch(`http://localhost:3000/cids?name=${term}`, { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//cids?name=${term}`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getDocs.ts b/actions/getDocs.ts index 2bc4a65..5910b7e 100644 --- a/actions/getDocs.ts +++ b/actions/getDocs.ts @@ -7,13 +7,16 @@ const getDocs = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/documents", { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents", + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getPlans.ts b/actions/getPlans.ts index 83a8498..df65e1f 100644 --- a/actions/getPlans.ts +++ b/actions/getPlans.ts @@ -1,7 +1,7 @@ const getPlans = async (_req: Request): Promise => { try { const response = await fetch( - "http://localhost:3000/products/subscriptions", + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//products/subscriptions", { method: "GET", headers: { diff --git a/actions/getProfile.ts b/actions/getProfile.ts index 25b9258..d03e929 100644 --- a/actions/getProfile.ts +++ b/actions/getProfile.ts @@ -7,13 +7,16 @@ const getUser = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/profile", { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//profile", + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getUser.ts b/actions/getUser.ts index 1b923db..be54bae 100644 --- a/actions/getUser.ts +++ b/actions/getUser.ts @@ -7,13 +7,16 @@ const getUser = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/me", { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/me", + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/getUserOrders.ts b/actions/getUserOrders.ts index 2f77f62..1078704 100644 --- a/actions/getUserOrders.ts +++ b/actions/getUserOrders.ts @@ -47,13 +47,16 @@ const getUserOrders = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/orders/", { - method: "GET", - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//orders/", + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/resendConfirmationCode.ts b/actions/resendConfirmationCode.ts index 18606c0..9e67b4f 100644 --- a/actions/resendConfirmationCode.ts +++ b/actions/resendConfirmationCode.ts @@ -8,7 +8,7 @@ const resendConfirmationCode = async ( ): Promise => { try { const response = await fetch( - "http://localhost:3000/auth/send-confirmation-code", + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/send-confirmation-code", { method: "POST", headers: { diff --git a/actions/updateProfile.ts b/actions/updateProfile.ts index 6a92b9b..ef3ee97 100644 --- a/actions/updateProfile.ts +++ b/actions/updateProfile.ts @@ -11,14 +11,17 @@ const getUser = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/profile", { - method: "PUT", - body: JSON.stringify(body), - headers: { - "Content-Type": "application/json", - Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//profile", + { + method: "PUT", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/actions/updateUserData.ts b/actions/updateUserData.ts index 7e67a73..8118020 100644 --- a/actions/updateUserData.ts +++ b/actions/updateUserData.ts @@ -38,27 +38,33 @@ const updateUserData = async ( }; try { - const responseUpdateProfile = await fetch("http://localhost:3000/profile", { - method: "PUT", - body: JSON.stringify(updateProfileBody), - headers: { - Authorization: token, - "Content-Type": "application/json", + const responseUpdateProfile = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//profile", + { + method: "PUT", + body: JSON.stringify(updateProfileBody), + headers: { + Authorization: token, + "Content-Type": "application/json", + }, }, - }); + ); const resProfile = await responseUpdateProfile.json(); console.log({ resProfile }); - const responseUpdateCognito = await fetch("http://localhost:3000/auth/me", { - method: "PUT", - body: JSON.stringify(updateCognitoUserBody), - headers: { - Authorization: token, - "Content-Type": "application/json", + const responseUpdateCognito = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/me", + { + method: "PUT", + body: JSON.stringify(updateCognitoUserBody), + headers: { + Authorization: token, + "Content-Type": "application/json", + }, }, - }); + ); const resCognito = await responseUpdateCognito.json(); diff --git a/actions/uploadFile.ts b/actions/uploadFile.ts index 9f201e5..b1cb5fc 100644 --- a/actions/uploadFile.ts +++ b/actions/uploadFile.ts @@ -19,14 +19,17 @@ const uploadFile = async ( ): Promise => { console.log({ dataBody: data }); try { - const response = await fetch("http://localhost:3000/files", { - method: "POST", - body: JSON.stringify(data), - headers: { - "Content-Type": "multipart/form-data;", - // Authorization: token, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//files", + { + method: "POST", + body: JSON.stringify(data), + headers: { + "Content-Type": "multipart/form-data;", + // Authorization: token, + }, }, - }); + ); const res = await response.json(); return res; diff --git a/components/ui/AdminNewDocModal.tsx b/components/ui/AdminNewDocModal.tsx index 7aafa07..0ef6294 100644 --- a/components/ui/AdminNewDocModal.tsx +++ b/components/ui/AdminNewDocModal.tsx @@ -43,10 +43,12 @@ const AdminNewDocModal = ( let url = ""; if (createType === "user") { - url = "http://localhost:3000/documents/admin/user"; + url = + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents/admin/user"; formData.append("user", userToAdminCreateDoc.value._id); } else if (createType === "association") { - url = "http://localhost:3000/documents/admin/association"; + url = + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents/admin/association"; formData.append("association", associationToAdminCreateDoc.value._id); } diff --git a/components/ui/AssociationAdmin.tsx b/components/ui/AssociationAdmin.tsx index c7f3019..561a79f 100644 --- a/components/ui/AssociationAdmin.tsx +++ b/components/ui/AssociationAdmin.tsx @@ -145,14 +145,17 @@ function MyAccount() { formData.append("category", "selfie_photo"); try { - const response = await fetch("http://localhost:3000/files", { - method: "POST", - body: formData, - headers: { - Authorization: localStorage.getItem("AccessToken") || "", - ContentType: "multipart/form-data", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//files", + { + method: "POST", + body: formData, + headers: { + Authorization: localStorage.getItem("AccessToken") || "", + ContentType: "multipart/form-data", + }, }, - }); + ); const r = await response.json(); setAssociationLogo(r.url); diff --git a/components/ui/ChoosePlanSignup.tsx b/components/ui/ChoosePlanSignup.tsx index 0888a20..a8e9b40 100644 --- a/components/ui/ChoosePlanSignup.tsx +++ b/components/ui/ChoosePlanSignup.tsx @@ -11,7 +11,7 @@ function ConfirmSignup() { useEffect(() => { try { const params = fetch( - `http://localhost:3000/v1/products/subscriptions`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//v1/products/subscriptions`, ).then(async (r) => { const c = await r.json(); console.log({ plans: c.docs }); diff --git a/components/ui/MyAccount.tsx b/components/ui/MyAccount.tsx index 9090972..9e03438 100644 --- a/components/ui/MyAccount.tsx +++ b/components/ui/MyAccount.tsx @@ -81,7 +81,7 @@ function MyAccount() { }); const params = fetch( - `http://localhost:3000/v1/products/subscriptions`, + `http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//v1/products/subscriptions`, ).then(async (r) => { const c = await r.json(); console.log({ plans: c.docs }); diff --git a/components/ui/MyDocs.tsx b/components/ui/MyDocs.tsx index c4dc300..d227454 100644 --- a/components/ui/MyDocs.tsx +++ b/components/ui/MyDocs.tsx @@ -188,14 +188,17 @@ const NewDocModal = ({ onFinishCreate }: { onFinishCreate: () => void }) => { formData.append("category", docCategory); try { - const response = await fetch("http://localhost:3000/documents", { - method: "POST", - body: formData, - headers: { - Authorization: localStorage.getItem("AccessToken") || "", - ContentType: "multipart/form-data", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//documents", + { + method: "POST", + body: formData, + headers: { + Authorization: localStorage.getItem("AccessToken") || "", + ContentType: "multipart/form-data", + }, }, - }); + ); const r = await response.json(); // console.log({ r }); diff --git a/components/ui/MyInfo.tsx b/components/ui/MyInfo.tsx index 83d458a..127ea58 100644 --- a/components/ui/MyInfo.tsx +++ b/components/ui/MyInfo.tsx @@ -105,14 +105,17 @@ function MyInfo() { formData.append("category", "selfie_photo"); try { - const response = await fetch("http://localhost:3000/files", { - method: "POST", - body: formData, - headers: { - Authorization: localStorage.getItem("AccessToken") || "", - ContentType: "multipart/form-data", + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//files", + { + method: "POST", + body: formData, + headers: { + Authorization: localStorage.getItem("AccessToken") || "", + ContentType: "multipart/form-data", + }, }, - }); + ); const r = await response.json(); setUserImg(r.url); diff --git a/components/ui/PrivatePageControl.tsx b/components/ui/PrivatePageControl.tsx index 84b5573..ab11f6a 100644 --- a/components/ui/PrivatePageControl.tsx +++ b/components/ui/PrivatePageControl.tsx @@ -19,14 +19,17 @@ function PrivatePageControl(props: Props) { } try { - const response = await fetch("http://localhost:3000/auth/me", { - method: "GET", - headers: { - "content-type": "application/json", - accept: "application/json", - Authorization: accessToken, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/me", + { + method: "GET", + headers: { + "content-type": "application/json", + accept: "application/json", + Authorization: accessToken, + }, }, - }).then((r) => r.json()); + ).then((r) => r.json()); const username = response.data.Username; diff --git a/components/ui/PrivatePageControlAdmin.tsx b/components/ui/PrivatePageControlAdmin.tsx index 3aeb5d2..3ede5bf 100644 --- a/components/ui/PrivatePageControlAdmin.tsx +++ b/components/ui/PrivatePageControlAdmin.tsx @@ -19,14 +19,17 @@ function PrivatePageControl(props: Props) { } try { - const response = await fetch("http://localhost:3000/v1/admin/me", { - method: "GET", - headers: { - "content-type": "application/json", - accept: "application/json", - Authorization: accessToken, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//v1/admin/me", + { + method: "GET", + headers: { + "content-type": "application/json", + accept: "application/json", + Authorization: accessToken, + }, }, - }); + ); console.log({ accessToken }); diff --git a/components/ui/PublicPageControl.tsx b/components/ui/PublicPageControl.tsx index 4fc54a9..4811e3d 100644 --- a/components/ui/PublicPageControl.tsx +++ b/components/ui/PublicPageControl.tsx @@ -12,14 +12,17 @@ export interface Props { function PublicPageControl(props: Props) { async function isLogged({ accessToken }: { accessToken: string }) { try { - const response = await fetch("http://localhost:3000/auth/me", { - method: "GET", - headers: { - "content-type": "application/json", - accept: "application/json", - Authorization: accessToken, + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/me", + { + method: "GET", + headers: { + "content-type": "application/json", + accept: "application/json", + Authorization: accessToken, + }, }, - }).then((r) => r.json()); + ).then((r) => r.json()); const username = response.data.Username; diff --git a/components/ui/Signout.tsx b/components/ui/Signout.tsx index 9671b8b..8cb418b 100644 --- a/components/ui/Signout.tsx +++ b/components/ui/Signout.tsx @@ -19,13 +19,16 @@ function Signout(props: Props) { } try { - fetch("http://localhost:3000/auth/sign-out", { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: token || "", + fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/sign-out", + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: token || "", + }, }, - }).then((r) => { + ).then((r) => { // apagar accress token if (IS_BROWSER) { localStorage.setItem("AccessToken", ""); diff --git a/loaders/getPublicProfile.ts b/loaders/getPublicProfile.ts index 60cfeda..bf5e8df 100644 --- a/loaders/getPublicProfile.ts +++ b/loaders/getPublicProfile.ts @@ -39,7 +39,10 @@ const getPublicProfile = async ( _req: Request, ): Promise => { try { - const response = await fetch("http://localhost:3000/auth/public/" + slug); + const response = await fetch( + "http://http://production.eba-93ecmjzh.us-east-1.elasticbeanstalk.com//auth/public/" + + slug, + ); const res = await response.json(); return res;