Fix google auth url broken (#2380)
* Fix google auth url broken * Refactor
This commit is contained in:
@ -8,3 +8,13 @@ export const REACT_APP_SERVER_BASE_URL =
|
|||||||
window._env_?.REACT_APP_SERVER_BASE_URL ||
|
window._env_?.REACT_APP_SERVER_BASE_URL ||
|
||||||
process.env.REACT_APP_SERVER_BASE_URL ||
|
process.env.REACT_APP_SERVER_BASE_URL ||
|
||||||
'http://localhost:3000';
|
'http://localhost:3000';
|
||||||
|
|
||||||
|
export const REACT_APP_SERVER_AUTH_URL =
|
||||||
|
window._env_?.REACT_APP_SERVER_AUTH_URL ||
|
||||||
|
process.env.REACT_APP_SERVER_AUTH_URL ||
|
||||||
|
REACT_APP_SERVER_BASE_URL + '/auth';
|
||||||
|
|
||||||
|
export const REACT_APP_SERVER_FILES_URL =
|
||||||
|
window._env_?.REACT_APP_SERVER_FILES_URL ||
|
||||||
|
process.env.REACT_APP_SERVER_FILES_URL ||
|
||||||
|
REACT_APP_SERVER_BASE_URL + '/files';
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import {
|
|||||||
useRecoilState,
|
useRecoilState,
|
||||||
} from 'recoil';
|
} from 'recoil';
|
||||||
|
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_AUTH_URL } from '~/config';
|
||||||
import {
|
import {
|
||||||
useChallengeMutation,
|
useChallengeMutation,
|
||||||
useCheckUserExistsLazyQuery,
|
useCheckUserExistsLazyQuery,
|
||||||
@ -136,8 +136,7 @@ export const useAuth = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => {
|
const handleGoogleLogin = useCallback((workspaceInviteHash?: string) => {
|
||||||
const authServerUrl =
|
const authServerUrl = REACT_APP_SERVER_AUTH_URL;
|
||||||
REACT_APP_SERVER_BASE_URL ?? REACT_APP_SERVER_BASE_URL + '/auth';
|
|
||||||
window.location.href =
|
window.location.href =
|
||||||
`${authServerUrl}/google/${
|
`${authServerUrl}/google/${
|
||||||
workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : ''
|
workspaceInviteHash ? '?inviteHash=' + workspaceInviteHash : ''
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_FILES_URL } from '~/config';
|
||||||
|
|
||||||
export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
|
export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
|
||||||
if (!imageUrl) {
|
if (!imageUrl) {
|
||||||
@ -13,8 +13,7 @@ export const getImageAbsoluteURIOrBase64 = (imageUrl?: string | null) => {
|
|||||||
return imageUrl;
|
return imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverFilesUrl =
|
const serverFilesUrl = REACT_APP_SERVER_FILES_URL;
|
||||||
REACT_APP_SERVER_BASE_URL ?? REACT_APP_SERVER_BASE_URL + '/files';
|
|
||||||
|
|
||||||
return `${serverFilesUrl}/${imageUrl}`;
|
return `${serverFilesUrl}/${imageUrl}`;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user