Something went wrong. Try again.
a tool for shared writing and social publishing
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031"use server";
import { drizzle } from "drizzle-orm/node-postgres";import { permission_token_on_homepage } from "drizzle/schema";import postgres from "postgres";import { v7 } from "uuid";import { sql, eq, inArray, and } from "drizzle-orm";import { cookies } from "next/headers";import { getIdentityData } from "./getIdentityData";import { pool } from "supabase/pool";
export async function removeLeafletFromHome(tokens: string[]) { const identity = await getIdentityData(); if (!identity) return null;
const client = await pool.connect(); const db = drizzle(client);
await db .delete(permission_token_on_homepage) .where( and( eq(permission_token_on_homepage.identity, identity.id), inArray(permission_token_on_homepage.token, tokens), ), );
client.release(); return true;}