You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
544 B

import ApiService from '@/services/api.service'
import { RoleItem } from '@/models/role'
import { RoleItemListRepository, RoleItemResponse } from './interface'
export class FromApiRoleItemListRepository implements RoleItemListRepository {
constructor(
private readonly request = ApiService
) {}
async list(): Promise<RoleItem[]> {
const url = `/roles`
const response = await this.request.get(url)
const responseItems: RoleItemResponse[] = response.data
return responseItems.map(item => RoleItem.valueOf(item))
}
}