sinProject-Inc/talk

View on GitHub
src/lib/locale/locales_api.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { Locale } from '@prisma/client'
import { Api, type Fetch } from '../api/api'
import { ApiPath } from '../api/api_path'

export class LocalesApi {
    private readonly _api_path: ApiPath

    public constructor(private readonly _fetch: Fetch = fetch) {
        this._api_path = ApiPath.api_directory.connect('locales')
    }

    public async fetch(): Promise<Locale[]> {
        const api = new Api(this._api_path, this._fetch)

        return await api.fetch<Locale[]>()
    }
}