some new server-side stuff

This commit is contained in:
2023-07-16 12:18:42 -05:00
parent 598b229689
commit b98e12d443
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import supabaseClient from "../services/supabase";
export default class ProjectsActions {
static api = supabaseClient();
static async getProjects() {
const { data, error } = await this.api.from("projects").select("*");
if (error) throw error;
return data;
}
static async getProjectsById(id: string) {
const { data, error } = await this.api.from("projects").select("*").eq("id", id);
if (error) throw error;
return data;
}
}

View File

@@ -0,0 +1,21 @@
'use server';
import supabaseClient from "../services/supabase";
export default class WorkActions {
static api = supabaseClient();
static async getWork() {
const { data, error } = await this.api.from("work").select("*");
if (error) throw error;
return data;
}
static async getWorkById(id: string) {
const { data, error } = await this.api.from("work").select("*").eq("id", id);
if (error) throw error;
return data;
}
}