Skip to content

Commit

Permalink
fix(nuxt3): async fn
Browse files Browse the repository at this point in the history
  • Loading branch information
LarchLiu committed May 18, 2023
1 parent ad41b73 commit a7cfc8a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/storage/notion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class NotionDataStorage extends DataStorage<NotionConfig, SavedNotion> {
}

async updateOgImage(info: SavedNotion, url: string) {
updateOgImage(this.config, info.storageId, url)
return await updateOgImage(this.config, info.storageId, url)
}

getConfig(): NotionConfig {
Expand Down Expand Up @@ -290,4 +290,7 @@ export async function updateOgImage(config: NotionConfig, storageId: string, url
},
})
}
return {
url,
}
}
4 changes: 2 additions & 2 deletions packages/core/src/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface SavedImage {

export interface IDataStorage {
create(data?: StorageData): Promise<SavedData>
updateOgImage(info: SavedData, url: string): Promise<any>
updateOgImage(info: SavedData, url: string): Promise<SavedImage>
getType(): StorageType
getConfig(): any
}
Expand All @@ -36,7 +36,7 @@ export abstract class DataStorage<T, R extends SavedData> implements IDataStorag
protected data?: StorageData

abstract create(data?: StorageData): Promise<R>
abstract updateOgImage(info: R, url: string): Promise<any>
abstract updateOgImage(info: R, url: string): Promise<SavedImage>
abstract getType(): StorageType
abstract getConfig(): T
}
Expand Down
4 changes: 2 additions & 2 deletions server/nuxt3/server/api/webcard.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default eventHandler(async (event) => {
else
imgRes = await imgStorage.create(res)

await dataStorage.updateOgImage(savedData, imgRes.url)
return imgRes
const updateRes = await dataStorage.updateOgImage(savedData, imgRes.url)
return updateRes
}
catch (error: any) {
setResponseStatus(event, 400)
Expand Down
4 changes: 2 additions & 2 deletions server/nuxt3/server/plugins/loadFonts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default defineNitroPlugin((nitroApp) => {
initBasicFonts()
export default defineNitroPlugin(async (nitroApp) => {
await initBasicFonts()
})
4 changes: 2 additions & 2 deletions server/nuxt3/server/plugins/tgBot.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default defineNitroPlugin((nitroApp) => {
initEnv()
export default defineNitroPlugin(async (nitroApp) => {
await initEnv()
})

1 comment on commit a7cfc8a

@vercel
Copy link

@vercel vercel bot commented on a7cfc8a May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

star-nexus – ./

star-nexus-git-main-larchliu.vercel.app
star-nexus-larchliu.vercel.app
star-nexus.vercel.app

Please sign in to comment.