mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-06 06:58:04 +08:00
🛠 Create getSvgContent function.
This commit is contained in:
parent
30beff7b67
commit
79e6b9ba8e
7
src/utils/getSvgContent.ts
Normal file
7
src/utils/getSvgContent.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export const MIMETYPE = 'text/plain';
|
||||
export const getSvgContent = async (url: string | undefined, isSupported: boolean) => {
|
||||
const response = await fetch(url || '');
|
||||
const content = await response.text();
|
||||
const blob = new Blob([content], { type: MIMETYPE });
|
||||
return isSupported ? blob : content;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user