@adventurelabs/scout-core
Version:
Core utilities and helpers for Adventure Labs Scout applications
22 lines (21 loc) • 654 B
JavaScript
"use server";
import { newServerClient } from "../supabase/server";
import { EnumWebResponse, IWebResponse, } from "../types/requests";
// function that fetches the layers from our db given a herd id
export async function server_get_layers_by_herd(herd_id) {
const supabase = await newServerClient();
const { data, error } = await supabase
.from("layers")
.select("*")
.eq("herd_id", herd_id);
if (error) {
return {
status: EnumWebResponse.ERROR,
msg: error.message,
data: null,
};
}
else {
return IWebResponse.success(data).to_compatible();
}
}