Skip to content

Commit

Permalink
Merge pull request #1 from Josedzzz/deploy
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
Josedzzz authored Nov 12, 2024
2 parents 6e5c180 + e464639 commit 7bcef06
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 43 deletions.
26 changes: 16 additions & 10 deletions src/services/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ export const refreshJwtToken = async () => {
const refreshThreshold = 5 * 60 * 1000; // 5 minutos antes de la expiracion

if (timeUntilExpiration < refreshThreshold) {
const response = await fetch("http://localhost:8080/auth/refresh-token", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
const response = await fetch(
"https://joki-events-production.up.railway.app/auth/refresh-token",
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
},
});
);

const data = await response.json();

Expand Down Expand Up @@ -72,12 +75,15 @@ export const refreshJwtTokenAdmin = async () => {
const refreshThreshold = 5 * 60 * 1000; // 5 minutos antes de la expiracion

if (timeUntilExpiration < refreshThreshold) {
const response = await fetch("http://localhost:8080/auth/refresh-token", {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
const response = await fetch(
"https://joki-events-production.up.railway.app/auth/refresh-token",
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
},
},
});
);

const data = await response.json();

Expand Down
4 changes: 2 additions & 2 deletions src/services/clientCartService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getClientShoppingCart = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/load-shopping-cart?page=${page}`,
`https://joki-events-production.up.railway.app/api/client/${userId}/load-shopping-cart?page=${page}`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -101,7 +101,7 @@ export const deleteLocalityOrder = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/cancel-locality-order`,
`https://joki-events-production.up.railway.app/api/client/${userId}/cancel-locality-order`,
{
method: "POST",
headers: {
Expand Down
6 changes: 3 additions & 3 deletions src/services/clientEventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const getAllClientEvents = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/get-paginated-events?page=${page}`,
`https://joki-events-production.up.railway.app/api/client/get-paginated-events?page=${page}`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -112,7 +112,7 @@ export const getSearchEvents = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/search-event?page=${page}`,
`https://joki-events-production.up.railway.app/api/client/search-event?page=${page}`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -161,7 +161,7 @@ export const orderLocality = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/order-locality`,
`https://joki-events-production.up.railway.app/api/client/${userId}/order-locality`,
{
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/clientHistoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getAllCoupons = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/purchase-history?page=${page}`,
`https://joki-events-production.up.railway.app/api/client/${userId}/purchase-history?page=${page}`,
{
method: "GET",
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/services/clientPayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getLinkClientPayment = async (): Promise<ApiResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/payment/${userId}/create-payment`,
`https://joki-events-production.up.railway.app/api/payment/${userId}/create-payment`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const applyCoupon = async (couponName: string): Promise<ApiResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/apply-coupon?couponName=${couponName}`,
`https://joki-events-production.up.railway.app/api/client/${userId}/apply-coupon?couponName=${couponName}`,
{
method: "POST",
headers: {
Expand Down
8 changes: 4 additions & 4 deletions src/services/couponService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const getAllCoupons = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/get-paginated-coupons?page=${page}`,
`https://joki-events-production.up.railway.app/api/admin/get-paginated-coupons?page=${page}`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -101,7 +101,7 @@ export const createCoupon = async (

try {
const response = await fetch(
"http://localhost:8080/api/admin/create-coupon",
"https://joki-events-production.up.railway.app/api/admin/create-coupon",
{
method: "POST",
headers: {
Expand Down Expand Up @@ -150,7 +150,7 @@ export const updateCoupon = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/${couponId}/update-coupon`,
`https://joki-events-production.up.railway.app/api/admin/${couponId}/update-coupon`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -196,7 +196,7 @@ export const deleteCoupon = async (couponId: string): Promise<ApiResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/admin/${couponId}/delete-coupon`,
`https://joki-events-production.up.railway.app/api/admin/${couponId}/delete-coupon`,
{
method: "POST",
headers: {
Expand Down
8 changes: 4 additions & 4 deletions src/services/eventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const getAllEvents = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/get-paginated-events?page=${page}`,
`https://joki-events-production.up.railway.app/api/admin/get-paginated-events?page=${page}`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -126,7 +126,7 @@ export const createEvent = async (

try {
const response = await fetch(
"http://localhost:8080/api/admin/create-event",
"https://joki-events-production.up.railway.app/api/admin/create-event",
{
method: "POST",
headers: {
Expand Down Expand Up @@ -176,7 +176,7 @@ export const updateEvent = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/${eventId}/update-event`,
`https://joki-events-production.up.railway.app/api/admin/${eventId}/update-event`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -222,7 +222,7 @@ export const deleteEvent = async (eventId: string): Promise<ApiResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/admin/${eventId}/delete-event`,
`https://joki-events-production.up.railway.app/api/admin/${eventId}/delete-event`,
{
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/loginService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const login = async (
): Promise<SuccessResponse> => {
try {
const response = await fetch(
`http://localhost:8080/auth/login-${typeUser}`,
`https://joki-events-production.up.railway.app/auth/login-${typeUser}`,
{
method: "POST",
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/services/reportService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getReports = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/get-report-events?month=${month}&year=${year}`,
`https://joki-events-production.up.railway.app/api/admin/get-report-events?month=${month}&year=${year}`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -86,7 +86,7 @@ export const getReportsPDF = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/get-reports-events-pdf?month=${month}&year=${year}`,
`https://joki-events-production.up.railway.app/api/admin/get-reports-events-pdf?month=${month}&year=${year}`,
{
method: "GET",
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/services/restorePassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const sendRecoverPasswordCode = async (
): Promise<ApiResponse> => {
try {
const response = await fetch(
`http://localhost:8080/auth/send-recover-password-code`,
`https://joki-events-production.up.railway.app/auth/send-recover-password-code`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const recoverPasswordCode = async (
): Promise<ApiResponse> => {
try {
const response = await fetch(
`http://localhost:8080/auth/recover-password`,
`https://joki-events-production.up.railway.app/auth/recover-password`,
{
method: "POST",
headers: {
Expand Down
15 changes: 9 additions & 6 deletions src/services/signupService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ export const signup = async (
credentials: signupCredentials,
): Promise<SuccessResponse> => {
try {
const response = await fetch("http://localhost:8080/auth/register-client", {
method: "POST",
headers: {
"Content-Type": "application/json",
const response = await fetch(
"https://joki-events-production.up.railway.apps/auth/register-client",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(credentials),
},
body: JSON.stringify(credentials),
});
);

if (!response.ok) {
// Handle the error response
Expand Down
4 changes: 2 additions & 2 deletions src/services/updateAdminService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const updateAdmin = async (

try {
const response = await fetch(
`http://localhost:8080/api/admin/${adminId}/update`,
`https://joki-events-production.up.railway.app/api/admin/${adminId}/update`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -95,7 +95,7 @@ export const getAdminAccountInfo = async (): Promise<AdminInfoResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/admin/${adminId}/get-admin-account-info`,
`https://joki-events-production.up.railway.app/api/admin/${adminId}/get-admin-account-info`,
{
method: "GET",
headers: {
Expand Down
6 changes: 3 additions & 3 deletions src/services/updateClientService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const updateClient = async (

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/update`,
`https://joki-events-production.up.railway.app/api/client/${userId}/update`,
{
method: "POST",
headers: {
Expand Down Expand Up @@ -97,7 +97,7 @@ export const getClientAccountInfo = async (): Promise<ClientInfoResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/get-client-account-info`,
`https://joki-events-production.up.railway.app/api/client/${userId}/get-client-account-info`,
{
method: "GET",
headers: {
Expand Down Expand Up @@ -144,7 +144,7 @@ export const deleteClientAccount = async (): Promise<ApiResponse> => {

try {
const response = await fetch(
`http://localhost:8080/api/client/${userId}/delete-account`,
`https://joki-events-production.up.railway.app/api/client/${userId}/delete-account`,
{
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/verifyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const verifyCode = async (code: string): Promise<string> => {

try {
const response = await fetch(
`http://localhost:8080/api/client/${clientId}/verify?verificationCode=${code}`,
`https://joki-events-production.up.railway.app/api/client/${clientId}/verify?verificationCode=${code}`,
{
method: "POST",
headers: {
Expand Down
3 changes: 3 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rewrites": [{ "source": "/(.*)", "destination": "/" }]
}

0 comments on commit 7bcef06

Please sign in to comment.