#is there a way to refresh the app from a custom hook?

8 messages · Page 1 of 1 (latest)

fleet steeple
#

I added a 'user' field to the 'directus_files' collection (ManyToOne) in order to organize files by user through a custom hook. The files to which a user is assigned (with a specific role that I have chosen for this feature) are automatically placed in a subfolder called 'user_files' using their names (first_name + last_name).

My entire system works perfectly. When I change the user of a file, it places the file in the respective user's folder or creates one if it doesn't exist. Additionally, if I move the file to another user's folder, it updates the file's associated user.

My only issue is that when I create a new folder by selecting a user who doesn't yet have his folder, the module navigation doesn't refresh. I'm forced to manually refresh the page.

so do you know if it's possible to trigger an action to refresh the navigation from within my custom hook?

wanton hearthBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

fleet steeple
mental dirge
#

Without running code in the browser/app there is no way to refresh it 😬 and hooks run on the server/api

fleet steeple
mental dirge
#

There is no such thing as app events😬 the app fetches/pulls from the API. The api cannot push to the app at this time

fleet steeple
#

too bad, that's what I was afraid of.. thanks anyway 😁

dreamy flame