Skip to content

Commit

Permalink
all links from API
Browse files Browse the repository at this point in the history
  • Loading branch information
GunkaArtur committed Apr 26, 2024
1 parent 99b1b7e commit 03c2607
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions public/editor-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ interface API {
fileUrl: string;
templates: DefaultTemplates;
openAIUrl?: string;
templatesImageUrl: string;
imagePatterns: ImagePatterns;
}
export interface Config {
Expand Down Expand Up @@ -142,6 +143,10 @@ const apiReader = parseStrict<PLUGIN_ENV["api"], API>({
throwOnNullish("Invalid API: templates")
),
openAIUrl: optional(pipe(mPipe(Obj.readKey("openAIUrl"), Str.read))),
templatesImageUrl: pipe(
mPipe(Obj.readKey("templatesImageUrl"), Str.read),
throwOnNullish("Invalid API: Image templates")
),
imagePatterns: pipe(
mPipe(
Obj.readKey("media"),
Expand Down
4 changes: 2 additions & 2 deletions public/editor-client/src/defaultTemplates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ const defaultPages = (
config: Config
): PagesDefaultTemplate<Pages, BlocksArray<DefaultBlock>> => {
const { templatesUrl } = config.api.templates;
const imageUrl = "https://cloud-1de12d.b-cdn.net/media/iW=1024&iH=1024/";
const { templatesImageUrl } = config.api;

return {
async getMeta(res, rej) {
try {
const { blocks, categories } = await getDefaultPages(templatesUrl);

res({
blocks: convertPages(blocks, imageUrl),
blocks: convertPages(blocks, templatesImageUrl),
categories: convertToCategories(categories)
});
} catch (e) {
Expand Down

0 comments on commit 03c2607

Please sign in to comment.