fix(model): 🐛 update enpoint for default rest ref resolver

This commit is contained in:
Julien Oculi 2024-05-13 18:01:54 +02:00
parent 03aff06804
commit 6280b02934

View file

@ -47,7 +47,7 @@ export class Ref<T extends Ressource> extends String {
static restResolver(endpoint: string | URL) { static restResolver(endpoint: string | URL) {
return async <T extends Ressource>(ref: RefString<T>) => { return async <T extends Ressource>(ref: RefString<T>) => {
const { type, uuid } = Ref.parse(ref) const { type, uuid } = Ref.parse(ref)
const url = new URL(`${type}/${uuid}`, endpoint) const url = new URL(`${type}s/${uuid}`, endpoint)
const response = await fetch(url) const response = await fetch(url)
const json = await response.json() const json = await response.json()