mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 00:47:53 +00:00
Frontend dev exp (#1866)
This commit is contained in:
1 parent
9646a791aa
commit
ea4563c1a8
5 files changed
+132
-175
No files matched your search
@@ -21,11 +21,15 @@ if (import.meta.env.DEV) {
|
||||
StorytellerApiHostStore.getInstance().setApiSchemeAndHost(
|
||||
window.location.origin,
|
||||
);
|
||||
// NB: This is for Brandon to test with storyteller-web locally:
|
||||
// (disabled — it overrides the origin above and points at localhost:12345,
|
||||
// which breaks dev unless a local backend is running. Re-enable only when
|
||||
// testing against a local storyteller-web.)
|
||||
//StorytellerApiHostStore.getInstance().setDevelopment();
|
||||
// Backend devs: launch with USE_LOCAL_API=1 (see
|
||||
// script/website/unix_frontend_webapp_dev.sh) to point API calls at a
|
||||
// local storyteller-web (http://localhost:12345). When unset — the
|
||||
// frontend-dev default — this branch never runs and API calls hit
|
||||
// production. Do not comment this in or out; set the env var instead.
|
||||
const useLocalApi = import.meta.env.VITE_USE_LOCAL_API;
|
||||
if (useLocalApi === "1" || useLocalApi === "true") {
|
||||
StorytellerApiHostStore.getInstance().setDevelopment();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to set dev API host override", e);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,15 @@ if (import.meta.env.DEV) {
|
||||
StorytellerApiHostStore.getInstance().setApiSchemeAndHost(
|
||||
window.location.origin,
|
||||
);
|
||||
// NB: This is for Brandon to test with storyteller-web locally:
|
||||
StorytellerApiHostStore.getInstance().setDevelopment();
|
||||
// Backend devs: launch with USE_LOCAL_API=1 (see
|
||||
// script/website/unix_frontend_website_dev.sh) to point API calls at a
|
||||
// local storyteller-web (http://localhost:12345). When unset — the
|
||||
// frontend-dev default — this branch never runs and API calls hit
|
||||
// production. Do not comment this in or out; set the env var instead.
|
||||
const useLocalApi = import.meta.env.VITE_USE_LOCAL_API;
|
||||
if (useLocalApi === "1" || useLocalApi === "true") {
|
||||
StorytellerApiHostStore.getInstance().setDevelopment();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to set dev API host override", e);
|
||||
}
|
||||
|
||||
Generated
+88
-168
File diff suppressed because it is too large.
Load diff
@@ -24,6 +24,19 @@ frontend_npm_install
|
||||
|
||||
export VITE_ENVIRONMENT_TYPE="production"
|
||||
|
||||
# # Backend devs: launch with USE_LOCAL_API=1 (or `export USE_LOCAL_API=1` once
|
||||
# # in your shell profile) to point the frontend at a local storyteller-web on
|
||||
# # http://localhost:12345. Unset/0 — the frontend-dev default — hits
|
||||
# # production. This replaces the comment/uncomment dance around
|
||||
# # StorytellerApiHostStore.setDevelopment() in src/main.tsx.
|
||||
# export VITE_USE_LOCAL_API="${USE_LOCAL_API:-0}"
|
||||
# if [[ "${VITE_USE_LOCAL_API}" == "1" ]]; then
|
||||
# echo "USE_LOCAL_API=1 — API calls will target http://localhost:12345"
|
||||
# else
|
||||
# echo "API calls will target production (set USE_LOCAL_API=1 for a local backend)"
|
||||
# fi
|
||||
export VITE_USE_LOCAL_API="true"
|
||||
|
||||
nx dev artcraft-webapp
|
||||
|
||||
popd || exit
|
||||
@@ -24,6 +24,19 @@ frontend_npm_install
|
||||
|
||||
export VITE_ENVIRONMENT_TYPE="production"
|
||||
|
||||
# # Backend devs: launch with USE_LOCAL_API=1 (or `export USE_LOCAL_API=1` once
|
||||
# # in your shell profile) to point the frontend at a local storyteller-web on
|
||||
# # http://localhost:12345. Unset/0 — the frontend-dev default — hits
|
||||
# # production. This replaces the comment/uncomment dance around
|
||||
# # StorytellerApiHostStore.setDevelopment() in src/main.tsx.
|
||||
# export VITE_USE_LOCAL_API="${USE_LOCAL_API:-0}"
|
||||
# if [[ "${VITE_USE_LOCAL_API}" == "1" ]]; then
|
||||
# echo "USE_LOCAL_API=1 — API calls will target http://localhost:12345"
|
||||
# else
|
||||
# echo "API calls will target production (set USE_LOCAL_API=1 for a local backend)"
|
||||
# fi
|
||||
export VITE_USE_LOCAL_API="true"
|
||||
|
||||
nx dev artcraft-website
|
||||
|
||||
popd || exit
|
||||
Reference in new issue
Block a user