mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
feat: rebuild app using vike
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export const BASE_URL =
|
||||
typeof window !== "undefined" ? location.protocol + "//" + location.host : "";
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { createTRPCReact } from "@trpc/react-query";
|
||||
import type { AppRouter } from "~/server/routers/_app";
|
||||
|
||||
export const getBaseUrl = () => {
|
||||
if (typeof window !== "undefined") return "";
|
||||
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||
};
|
||||
|
||||
const trpc = createTRPCReact<AppRouter>({});
|
||||
|
||||
export default trpc;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import { BASE_URL } from "./consts";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function getFileExt(filename: string) {
|
||||
return filename.substring(filename.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
export function getUrl(...path: string[]) {
|
||||
return BASE_URL + ("/" + path.join("/")).replace(/\/\/+/g, "/");
|
||||
}
|
||||
Reference in New Issue
Block a user