24 lines
635 B
JavaScript
24 lines
635 B
JavaScript
import UsersApiService from "../services/UsersApiService";
|
|
|
|
export async function getUserByUsername(username) {
|
|
const expand = `?username=${username}`;
|
|
const users = await UsersApiService.getAll(expand);
|
|
if (users) {
|
|
if (users.length == 1) {
|
|
return users[0];
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export async function getUserByUsernameAndPassword(username, password) {
|
|
const expand = `?username=${username}&password=${password}`;
|
|
const users = await UsersApiService.getAll(expand);
|
|
if (users) {
|
|
if (users.length == 1) {
|
|
return users[0];
|
|
}
|
|
}
|
|
return null;
|
|
}
|