generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
921234a
commit 89be498
Showing
4 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import type {QuickInsert} from "@/type/editor"; | ||
import type { QuickInsert } from "@/type/editor"; | ||
|
||
export const fetchAllQuickInsert = async (): Promise<QuickInsert[]> => { | ||
export const fetchAllQuickInsert = async ( | ||
quickInsertUrls: { url: string }[] | ||
): Promise<QuickInsert[]> => { | ||
const quickInsertList: QuickInsert[] = []; | ||
// Get Default Path | ||
try { | ||
const response = await fetch("/plugins/vditor-mde/assets/static/test.json"); | ||
const quickInsertJson: QuickInsert = await response.json(); | ||
quickInsertList.push(quickInsertJson); | ||
} catch (e) { | ||
// ignore this | ||
for (const qi of quickInsertUrls) { | ||
try { | ||
const response = await fetch(qi.url); | ||
const quickInsertJson: QuickInsert = await response.json(); | ||
quickInsertList.push(quickInsertJson); | ||
} catch (e) { | ||
// ignore this | ||
} | ||
} | ||
return quickInsertList; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters