Skip to content

Instantly share code, notes, and snippets.

Created July 9, 2022 15:00
What would you like to do?
export class UsersService {
private apiEndpoint: string;
constructor() {
this.apiEndpoint = "https://localhost:7131/Users";
getAllUsers = async (): Promise<UserViewModel[]> => {
const url = `${this.apiEndpoint}/AllUsers`;
const response = await fetch(url);
const users = (await response.json()) as UserViewModel[];
return users;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment