diff options
author | Vitaly Takmazov | 2024-02-14 16:21:06 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-02-18 18:08:07 +0300 |
commit | 09f83f8f6c6c1021d7709be799c1d2c5b3bf3016 (patch) | |
tree | f98097e45cbbd64e74dc47b50c2bd156810b4f73 | |
parent | c9c500a07d58fbbbe8bfd1cbc326140872ccc785 (diff) |
vnext: configure devserver proxy
-rw-r--r-- | vnext/src/App.js | 2 | ||||
-rw-r--r-- | vnext/src/api/index.js | 10 | ||||
-rw-r--r-- | vnext/src/ui/Feeds.js | 2 | ||||
-rw-r--r-- | vnext/src/ui/Message.js | 2 | ||||
-rw-r--r-- | vnext/webpack.config.js | 10 |
5 files changed, 15 insertions, 11 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index b14e50ab..9612bd83 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -117,7 +117,7 @@ export default function App({ footer }) { <span className="desktop">Settings</span> </Link> </> : - <a href={`/login?retpath=${window.location.href}`}> + <a href={`https://juick.com/login?retpath=${window.location.href}`}> <Icon name="ei-user" size="s" /> <span className="desktop">Login</span> </a> diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js index 095e18b8..7d878864 100644 --- a/vnext/src/api/index.js +++ b/vnext/src/api/index.js @@ -1,7 +1,5 @@ import axios from 'axios' -const apiBaseUrl = 'https://beta.juick.com' - /** * @typedef {object} Token * @property {string} type @@ -70,9 +68,7 @@ const apiBaseUrl = 'https://beta.juick.com' */ -const client = axios.create({ - baseURL: apiBaseUrl -}) +const client = axios.create({ baseURL: '' }) /** * fetch my info @@ -181,7 +177,7 @@ export function updateAvatar(newAvatar) { * @param {string} network */ function socialLink(network) { - return `${apiBaseUrl}/api/_${network}login?state=${window.location.protocol}//${window.location.host}${window.location.pathname}` + return `/api/_${network}login?state=${window.location.protocol}//${window.location.host}${window.location.pathname}` } /** @@ -210,7 +206,7 @@ export function appleLink() { * @param {SecureUser} visitor */ export function markReadTracker(msg, visitor) { - return `${apiBaseUrl}/api/thread/mark_read/${msg.mid}-${msg.rid || 0}.gif?hash=${visitor.hash}` + return `/api/thread/mark_read/${msg.mid}-${msg.rid || 0}.gif?hash=${visitor.hash}` } let profileCache = {} diff --git a/vnext/src/ui/Feeds.js b/vnext/src/ui/Feeds.js index 0cebdce6..31c76e66 100644 --- a/vnext/src/ui/Feeds.js +++ b/vnext/src/ui/Feeds.js @@ -35,7 +35,7 @@ function RequireAuth({ children }) { // trying to go to when they were redirected. This allows us to send them // along to that page after they login, which is a nicer user experience // than dropping them off on the home page. - return <Navigate to={`/login?retpath=${window.location.href}`} state={{ from: location }} /> + return <Navigate to={`https://juick.com/login?retpath=${window.location.href}`} state={{ from: location }} /> } return children diff --git a/vnext/src/ui/Message.js b/vnext/src/ui/Message.js index eaac8eba..9f0e9a15 100644 --- a/vnext/src/ui/Message.js +++ b/vnext/src/ui/Message.js @@ -112,7 +112,7 @@ export default function Message({ data, isThread, onToggleSubscription, children <span>{likesSummary}</span> </Link> ) : ( - <a href={`/login?retpath=${window.location.href}`} className="a-login msg-button"> + <a href={`https://juick.com/login?retpath=${window.location.href}`} className="a-login msg-button"> <Icon name="ei-heart" size="s" /> <span>{likesSummary}</span> </a> diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js index 6e35235c..12c6e75c 100644 --- a/vnext/webpack.config.js +++ b/vnext/webpack.config.js @@ -88,7 +88,15 @@ module.exports = (env, argv) => { historyApiFallback: true, client: { overlay: true - } + }, + proxy: [{ + context: ['/api'], + target: 'http://localhost:8080', + router: () => 'https://juick.com', + secure: false, + withCredentials: true, + changeOrigin: true + }] } } else { config.plugins.push( |