chore: support update show version

This commit is contained in:
Joel 2024-11-22 15:32:27 +08:00
parent 57756b18e4
commit b93be49530
3 changed files with 4 additions and 3 deletions

View File

@ -76,9 +76,10 @@ const PluginPage = ({
await sleep(100) await sleep(100)
if (packageId) { if (packageId) {
const { data } = await fetchManifestFromMarketPlace(encodeURIComponent(packageId)) const { data } = await fetchManifestFromMarketPlace(encodeURIComponent(packageId))
const { plugin } = data const { plugin, version } = data
setManifest({ setManifest({
...plugin, ...plugin,
version: version.version,
icon: `${marketplaceApiPrefix}/plugins/${plugin.org}/${plugin.name}/icon`, icon: `${marketplaceApiPrefix}/plugins/${plugin.org}/${plugin.name}/icon`,
}) })
showInstallFromMarketplace() showInstallFromMarketplace()

View File

@ -79,7 +79,7 @@ export type PluginManifestInMarket = {
icon: string icon: string
label: Record<Locale, string> label: Record<Locale, string>
category: PluginType category: PluginType
version: string // TODO: wait api return current plugin version version: string // conbine the other place to it
latest_version: string latest_version: string
brief: Record<Locale, string> brief: Record<Locale, string>
introduction: string introduction: string

View File

@ -63,7 +63,7 @@ export const fetchManifest = async (uniqueIdentifier: string) => {
} }
export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => { export const fetchManifestFromMarketPlace = async (uniqueIdentifier: string) => {
return getMarketplace<{ data: { plugin: PluginManifestInMarket } }>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`) return getMarketplace<{ data: { plugin: PluginManifestInMarket, version: { version: string } } }>(`/plugins/identifier?unique_identifier=${uniqueIdentifier}`)
} }
export const fetchMarketplaceCollections: Fetcher<MarketplaceCollectionsResponse, { url: string; }> = ({ url }) => { export const fetchMarketplaceCollections: Fetcher<MarketplaceCollectionsResponse, { url: string; }> = ({ url }) => {