refactor(server/utils): create utility to return forum database's uid using the actual site's user id

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2023-10-03 01:10:00 -04:00
parent 97d3f86c5a
commit 490fa1469e
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

16
lib/server/forumId.ts Normal file
View File

@ -0,0 +1,16 @@
import { H3Event, EventHandlerRequest } from "h3";
import { apiRoot } from "./constants";
export default async function (id: number): Promise<number> {
let { data: lookup } = await useFetch<any>(
`${apiRoot}/session-sharing/lookup`,
{
method: "get",
query: {
params: {
id,
},
},
},
);
return lookup.value.uid as number;
}