Skip to content

Commit

Permalink
Apply TS suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: sarayourfriend <[email protected]>
  • Loading branch information
obulat and sarayourfriend authored Jul 12, 2023
1 parent c05250e commit 1c6bcb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
6 changes: 3 additions & 3 deletions frontend/src/stores/media/single-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ export const useSingleResultStore = defineStore("single-result", {
/**
* Fetch the media item from the API.
*/
async fetchMediaItem<T extends SupportedMediaType>(
type: SupportedMediaType,
async fetchMediaItem<MediaType extends SupportedMediaType>(
type: MediaType,
id: string
): Promise<DetailFromMediaType<typeof type>> {
): Promise<DetailFromMediaType<MediaType>> {
this._updateFetchState("start")
const accessToken = this.$nuxt.$openverseApiToken
const service = initServices[type](accessToken)
Expand Down
14 changes: 2 additions & 12 deletions frontend/src/types/fetch-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ export interface BaseFetchState {
isFinished?: boolean
}

export interface FetchState extends BaseFetchState {
fetchingError: null | string
}

/**
* The fetching error has the props required for Nuxt's
* error page.
* TODO: replace FetchState with FetchStateWithNuxtError
* in the provider, main media and related media stores.
*/
export interface FetchStateWithNuxtError extends BaseFetchState {
fetchingError: null | NuxtError
export interface FetchState<ErrorType = string> extends BaseFetchState {
fetchingError: null | ErrorType
}

0 comments on commit 1c6bcb0

Please sign in to comment.