Created
June 18, 2025 08:32
-
-
Save infomiho/e98e524d252abbc53e558f957e04b689 to your computer and use it in GitHub Desktop.
Wasp setting server URL dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app axiosTest { | |
wasp: { | |
version: "^0.16.0" | |
}, | |
title: "axios-test", | |
auth: { | |
userEntity: User, | |
methods: { | |
usernameAndPassword: {}, // This is a very naive implementation, use 'email' in production instead | |
//google: {}, // https://wasp.sh/docs/integrations/google | |
//gitHub: {}, // https://wasp.sh/docs/integrations/github | |
//email: {} // https://wasp.sh/docs/guides/email-auth | |
}, | |
onAuthFailedRedirectTo: "/login", | |
}, | |
client: { | |
setupFn: import { setUpClient } from "@src/clientSetup", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { api } from "wasp/client/api"; | |
export function setUpClient() { | |
if (window.location.hostname !== "localhost") { | |
api.defaults.baseURL = "http://someother.com"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment