Pjaijai/Referalah

[Create Post] Should redirect user to post detail page instead of referrer page after creating a new post

Closed this issue · 6 comments

Screenshot 2023-11-06 at 2 03 33 PM

Currently onSuccess of the create post form will redirect user to referrer page, which is weird in terms of the user flow.

The main difficulty seems to be not getting the new post data as a response upon creating a post successfully. It is hard to redirect the user to the new post without its uuid.

I found the .select() method from supabase doc. It may help, but I still haven't figured out the best way to implement it in our code.

Your are right. Since we dont have detail post page that time

@cyruscsc I supabase will return the data after creating ?

https://supabase.com/docs/reference/javascript/insert

const { data, error } = await supabase .from('countries') .insert({ id: 1, name: 'Denmark' }) .select()

@Pjaijai I think you can just return the uuid by .select("uuid") as you don't really need the details? You will call GET API in the details page anyway

@marukosy124 @cyruscsc Created a PR please check #230

Done