How to return data from App proxy endpoint to Theme extension liquid

Solved

How to return data from App proxy endpoint to Theme extension liquid

danielbezerra
Shopify Partner
4 1 0

Hey guys, so i just created an App proxy endpoint in my remix template App and im able to receive data, but im not understandting how to return data. I get status code 302 on the response, and nothing is returned. Also its followed by a 404 login call, that im not sure what it is.

 

I have my proxy enpoind defined in app.tsx

<Link to="/app/backend2">Backend endpoint</Link>
 
and the service is this
 
export const action: ActionFunction = async ({ request }) => {
console.log("-----hit app proxy---------------");

const { session } = await authenticate.public.appProxy(request);
if (session) {
console.log("response", session);
}
return json({ message: "success" });
};

const Proxy = () => {
return <Page>Proxy</Page>;
};

export default Proxy;
 
any ideas what im doing wrong
Accepted Solution (1)

danielbezerra
Shopify Partner
4 1 0

This is an accepted solution.

nevermind my bad, i just had to erase the part where it returns a html component 

const Proxy = () => {
return <Page>Proxy</Page>;
};

 

export default Proxy;
 
and just left the action function in the file, and now its returning the response

View solution in original post

Replies 2 (2)
danielbezerra
Shopify Partner
4 1 0

ok, how?..

danielbezerra
Shopify Partner
4 1 0

This is an accepted solution.

nevermind my bad, i just had to erase the part where it returns a html component 

const Proxy = () => {
return <Page>Proxy</Page>;
};

 

export default Proxy;
 
and just left the action function in the file, and now its returning the response