I need help on how to utilize the Files functionality within Divhunt. Your platform doesn’t seem to have any documentation, although I found a dead link to https://docs.divhunt.com
When creating a Default JS file, my code executes automatically and console.logs are displayed in the developer tools as expected. When I create a Module file, the code does not run, and no output is shown in the console.
Here are my specific questions:
How can I ensure that code within a Module file is executed? Are there special steps or a specific syntax required to run or import modules? Same question applies to plugins, functions and classes.
When naming files, should I append .js extension to the filename or is it handled automatically by the platform?
What is the recommended way for referencing other files within Divhunt? Do I use relative paths like ./file1.js or is there a different protocol?
Sorry, I should have elaborated on what I am trying to accomplish. In this case I am trying to pull records in from my Supabase backend, and the only way I’ve managed to get this working is by using the Custom Code feature (Head Start):
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
<script>
// Use window.supabase to access the global supabase object from the CDN
const supabaseClient = window.supabase.createClient('https://PUBLIC.supabase.co', 'KEY_HERE');
async function fetchProducts() {
const { data: supadata, error } = await supabaseClient
.from('products')
.select();
if (error) console.error(error);
console.log(supadata);
}
fetchProducts();
console.log("Fetch complete");
</script>
It seems to me there should be a better way of doing this using the Files feature though, right? Just slapping everything in the <head> doesn’t seem ideal.
Hey @dejan I know you’re working on Workflow tutorials, but I’m wondering if you could pop in and answer this one (in addition to the ones above ).
If I want to access data from a variable in my Javascript code shown above in a Workflow, how would I do that? For example, I want to use the supadata array of objects.
Please allow me a bit more time and I’ll write proper explanation here, and yes it’s way better if you do it with Files feature and you can incorporate all those data natively into variables or similar.
Also, trying to figure this process out. I’ve wasted so much time searching for answers but can’t seem to find anything.
I’ve asked in the community but it doesn’t seem like anyone has done this or they haven’t seen the post because I didn’t get a response.
I’m trying to create a membership/community and I figured Supabase would be the best way to go about it. But I’m having trouble understanding how I can connect everything.
I should just be able to upload a file like ‘supabase.js’ that includes the supabase js library. Then connect that to my divhunt project. Once that’s done I’ll be able to communicate with Supabase through the API’s, correct?
If anyone is knowledgeable about this, please respond. Or I’d love to get in contact with you.
i’m having a difficult time figuring all this out and I can’t find any answers.