mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
15 lines
411 B
TypeScript
15 lines
411 B
TypeScript
import { optimizeSvg } from "@/utils/optimizeSvg";
|
|
|
|
interface SourceParams {
|
|
url: string | undefined;
|
|
optimize?: boolean;
|
|
}
|
|
|
|
export const getSource = async (params: SourceParams) => {
|
|
const response = await fetch(params.url || "");
|
|
const content = await response.text();
|
|
if (!params.optimize) return content;
|
|
const optimizedContent = optimizeSvg({ svgCode: content });
|
|
return optimizedContent;
|
|
};
|