Skip to content

Commit

Permalink
changed api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
baufaker committed Apr 24, 2024
1 parent 90f63da commit 666dc5b
Show file tree
Hide file tree
Showing 40 changed files with 296 additions and 206 deletions.
2 changes: 1 addition & 1 deletion actions/adminGetAssociation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getAssociation = async (
): Promise<AssociationAdmin> => {
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: {
Expand Down
6 changes: 4 additions & 2 deletions actions/adminGetAssociationUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ const getAssociation = async (
_req: Request,
): Promise<AssociationUsersResponse> => {
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, {
Expand Down
6 changes: 4 additions & 2 deletions actions/adminGetOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ const adminGetOrders = async (
{ token, params }: Props,
_req: Request,
): Promise<PaginationOrderResponse> => {
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 {
Expand Down
2 changes: 1 addition & 1 deletion actions/adminUpdateAssociation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getAssociation = async (
): Promise<unknown> => {
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),
Expand Down
17 changes: 10 additions & 7 deletions actions/changePassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ const changePassword = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
17 changes: 10 additions & 7 deletions actions/changeSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 9 additions & 6 deletions actions/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ const checkout = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
17 changes: 10 additions & 7 deletions actions/checkoutv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 12 additions & 9 deletions actions/cognitoAdminSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ const signInCognito = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
21 changes: 12 additions & 9 deletions actions/cognitoSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ const signInCognito = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
25 changes: 14 additions & 11 deletions actions/cognitoSignUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ const signUpCognito = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
21 changes: 12 additions & 9 deletions actions/confirmCognitoSignup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ const confirmCognitoSignup = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
2 changes: 1 addition & 1 deletion actions/confirmForgotPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const confirmForgotPassword = async (
): Promise<unknown | null> => {
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: {
Expand Down
2 changes: 1 addition & 1 deletion actions/deleteAssociationDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion actions/deleteDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
19 changes: 11 additions & 8 deletions actions/forgotPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ const forgotPassword = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
13 changes: 8 additions & 5 deletions actions/getAssociation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ const getAssociation = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
2 changes: 1 addition & 1 deletion actions/getAssociationDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getDocs = async (
): Promise<unknown | null> => {
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: {
Expand Down
13 changes: 8 additions & 5 deletions actions/getCardProduct.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
const getPlans = async (_req: Request): Promise<unknown | null> => {
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;
Expand Down
15 changes: 9 additions & 6 deletions actions/getCids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ const getCids = async (
_req: Request,
): Promise<unknown | null> => {
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;
Expand Down
Loading

0 comments on commit 666dc5b

Please sign in to comment.