tailflow / laravel-orion

The simplest way to create REST API with Laravel

Home Page:https://orion.tailflow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GET request pending after STORE operation on IOS ONLY

ElianRruga0 opened this issue · comments

I am using Laravel Orion on my Expo Go project (SDK 49). Everything works fine until I call .store().

Then I get Network Error. This happens only on IOS. On Android is working fine.

This is my config:

Orion.init("https://url");

axios.defaults.baseURL = "https://url/api/";
axios.defaults.headers.common["Accept"] = "application/json, text/plain, */*";
axios.defaults.headers.common["Content-type"] = "application/json";
axios.defaults.headers.common["Accept-Encoding"] = "gzip, deflate, br";
axios.defaults.headers.common["Connection"] = "keep-alive";

store.subscribe(() => {
  const token = store.getState().user.token;
  axios.defaults.headers.common["Authorization"] = `Bearer ${token}`;
  Orion.setToken(token);
});

This is my .store() function if it helps:

const report = await Report.$query().store({
            title: title,
            comment: comment,
            is_final: isFinal,
            user_id: userId,
            report_status_id: 1,
            task_id: parseInt(taskId.toString()),
            created_at: new Date(),
            images: ids,
          });

I am using @tanstack/react-query and I am calling refetch on useFocusEffect from expo-router.
I tried fetching the data without @tanstack/react-query but I still had the same issue.

Thank you for your time.

Hi @ElianRruga0,

The issue is not related to the Orion itself. Please investigate further, as it most likely has something to do with CORS/CSP in your project.