diff --git a/http/auth.ts b/http/auth.ts index 9a5edf72d..3a77711b7 100644 --- a/http/auth.ts +++ b/http/auth.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -const AUTH_HTTP_URL = 'https://zuri-auth.up.railway.app/api/v1'; +export const AUTH_HTTP_URL = 'https://zuri-auth.up.railway.app/api/v1'; const $http = axios.create({ baseURL: AUTH_HTTP_URL, diff --git a/http/checkout.ts b/http/checkout.ts index ceb0cca08..7c07e2d46 100644 --- a/http/checkout.ts +++ b/http/checkout.ts @@ -2,6 +2,7 @@ import { MARKETPLACE_API_URL } from '@modules/marketplace/http'; import { CartItemProps } from '../@types'; import $http from './axios'; import axios from 'axios'; +import { AUTH_HTTP_URL } from './auth'; @@ -10,7 +11,6 @@ import axios from 'axios'; export const STAGING_URL = process.env.NEXT_PUBLIC_APP_STAGING_URL || 'https://staging.zuri.team'; export const API_BASE_URL = process.env.NEXT_PUBLIC_BACKEND_ENDPOINT_URL || 'https://zuriportfolio-backend.onrender.com/api/v1' export const RECENTLY_VIEWED_ENDPOINT = 'https://staging.zuri.team/api/marketplace/v1/recently-viewed'; -export const AUTH_API_ENDPOINT = "https://zuri-auth.up.railway.app/api/auth/api" export const CART_ENDPOINT = API_BASE_URL + "/checkout"; @@ -64,10 +64,10 @@ export const removeFromCart = async (productId: string, token: string) => { throw error; } }; -// https://zuri-auth.up.railway.app/api/auth/api/ + export const createTempUser = async (datas: { email: string; firstName: string; lastName: string }) => { try { - const apiUrl = 'https://zuri-auth.up.railway.app/api/auth/api/auth/signup-guest'; + const apiUrl = `${AUTH_HTTP_URL}/auth/signup-guest`; const response = await $http.post(apiUrl, datas); return response.data; } catch (error) { @@ -143,7 +143,7 @@ export const makePayment = async (selectedPaymentMethod: string, token: string) const getTokenDetails = async (token: string) => { try { - const response = await $http.post(`${AUTH_API_ENDPOINT}/authorize`, { token }); + const response = await $http.post(`${AUTH_HTTP_URL}/authorize`, { token }); return response.data; } catch (error) { return error; diff --git a/modules/auth/component/AuthSocialButtons/SignUpWithFacebook.tsx b/modules/auth/component/AuthSocialButtons/SignUpWithFacebook.tsx index 36e6ea89c..39fec4535 100644 --- a/modules/auth/component/AuthSocialButtons/SignUpWithFacebook.tsx +++ b/modules/auth/component/AuthSocialButtons/SignUpWithFacebook.tsx @@ -2,6 +2,7 @@ import React from 'react'; import Image from 'next/image'; import SignUpWithSocialsButton from './SignUpWithSocialsButton'; import facebookLogo from '../../../../public/assets/images/logo/facebook-logo.svg'; +import { AUTH_HTTP_URL } from '../../../../http/auth'; const SignUpWithFacebook = () => { return ( @@ -9,7 +10,7 @@ const SignUpWithFacebook = () => { onClick={function (): void { throw new Error('Function not implemented.'); }} - href="https://zuri-auth.up.railway.app/api/auth/api/auth/facebook" + href={`${AUTH_HTTP_URL}/auth/facebook`} leftIcon={Facebook Logo} > Continue with Facebook diff --git a/modules/auth/component/AuthSocialButtons/SignUpWithGithub.tsx b/modules/auth/component/AuthSocialButtons/SignUpWithGithub.tsx index 953749204..6bb7ab53c 100644 --- a/modules/auth/component/AuthSocialButtons/SignUpWithGithub.tsx +++ b/modules/auth/component/AuthSocialButtons/SignUpWithGithub.tsx @@ -2,13 +2,14 @@ import React from 'react'; import Image from 'next/image'; import SignUpWithSocialsButton from './SignUpWithSocialsButton'; import githubLogo from '../../../../public/assets/images/logo/github-logo.svg'; +import { AUTH_HTTP_URL } from '../../../../http/auth'; const SignUpWithGithub = () => { return ( } > Continue with Github diff --git a/modules/auth/component/AuthSocialButtons/SignUpWithGoogle.tsx b/modules/auth/component/AuthSocialButtons/SignUpWithGoogle.tsx index ad2e55330..1eb456407 100644 --- a/modules/auth/component/AuthSocialButtons/SignUpWithGoogle.tsx +++ b/modules/auth/component/AuthSocialButtons/SignUpWithGoogle.tsx @@ -3,6 +3,7 @@ import Image from 'next/image'; import SignUpWithSocialsButton from './SignUpWithSocialsButton'; import googleLogo from '../../../../public/assets/Google.png'; import LogoCarousel from '@modules/home/carousel/logos/logosCarousel'; +import { AUTH_HTTP_URL } from '../../../../http/auth'; const SignUpWithGoogle = () => { const [isloading, setIsLoading] = useState(false); @@ -10,15 +11,14 @@ const SignUpWithGoogle = () => { const handleLinkClick = () => { setIsLoading(true); setTimeout(() => { - window.location.href = 'https://zuri-auth.up.railway.app/api/auth/api/auth/google'; + window.location.href = `${AUTH_HTTP_URL}/auth/google` }, 5000); }; - //href="https://zuri-auth.up.railway.app/api/auth/api/auth/google" + return ( // the google logo has white space around it, so i am reducing the margin on the right so all the buttons look similar { // This function will be called when you call the mutate function - // https://zuri-auth.up.railway.app/api/auth/api/authorize - return axios.put('https://zuri-auth.up.railway.app/api/auth/api/auth/reset-password/change', formData); + + return axios.put(`${AUTH_HTTP_URL}/auth/reset-password/change`, formData); }, { // onSuccess callback is triggered when the mutation is successful