Skip to content

Commit

Permalink
fix remaining backend url fetches
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmerk committed Oct 4, 2024
1 parent 8c22569 commit a1b7e9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gui_dev/src/stores/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const useSessionStore = createPersistStore("session", (set, get) => ({
// Stream initialization in the backend
initializeOfflineStream: async () => {
try {
const response = await fetch("/api/setup-Offline-stream", {
const response = await fetch(getBackendURL("/api/setup-Offline-stream"), {
method: "POST",
headers: {
Accept: "application/json",
Expand Down Expand Up @@ -157,7 +157,7 @@ export const useSessionStore = createPersistStore("session", (set, get) => ({
const lslSource = get().lslSource;
const streamParameters = get().streamParameters;

const response = await fetch("/api/setup-LSL-stream", {
const response = await fetch(getBackendURL("/api/setup-LSL-stream"), {
method: "POST",
headers: {
Accept: "application/json",
Expand Down Expand Up @@ -219,7 +219,7 @@ export const useSessionStore = createPersistStore("session", (set, get) => ({
JSON.stringify({ channels: get().channels })
);

const response = await fetch("/api/channels", {
const response = await fetch(getBackendURL("/api/channels"), {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
3 changes: 2 additions & 1 deletion gui_dev/src/utils/FileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @property {string} created_at - The creation timestamp of the file
* @property {string} modified_at - The last modification timestamp of the file
*/
import { getBackendURL } from "@/utils/getBackendURL";

/**
* Manages file operations and interactions with the file API
Expand Down Expand Up @@ -40,7 +41,7 @@ export class FileManager {
show_hidden: showHidden,
});

const response = await fetch(`${this.apiBaseUrl}/api/files?${queryParams}`);
const response = await fetch(getBackendURL(`${this.apiBaseUrl}/api/files?${queryParams}`));

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
Expand Down
3 changes: 2 additions & 1 deletion gui_dev/src/utils/debounced_sync.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { debounce } from "@/utils";
import { getBackendURL } from "@/utils/getBackendURL";

const DEBOUNCE_MS = 500; // Adjust as needed


const syncWithBackend = async (state) => {
try {
const response = await fetch("/api/experiment-session", {
const response = await fetch(getBackendURL("/api/experiment-session"), {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(state),
Expand Down

0 comments on commit a1b7e9a

Please sign in to comment.