Update core smartproc

This commit is contained in:
Titan Hadiyan
2023-05-29 10:48:07 +07:00
parent fc7a97585a
commit e577788c80
36 changed files with 1303 additions and 348 deletions

View File

@@ -13,12 +13,52 @@ export default {
try {
// Send request
console.log(email, password);
this._user = { ...defaultUser, email };
// this._user = { ...defaultUser, email };
return {
isOk: true,
data: this._user
// return {
// isOk: true,
// data: this._user
// };
const requestOptions = {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: email, password: password }),
};
const response = await fetch('http://localhost:9090/api/authentication/login', requestOptions);
const data = await response.json();
console.log(data);
//console.log(data.data.length);
// this._user = {
// id: response.data.id,
// email: response.data.role,
// name: response.data.keterangan,
// role_id: response.data.id,
// };
if(data.status == 'sukses') {
const defaultUser = {
email: data.data.email,
avatarUrl: 'https://js.devexpress.com/Demos/WidgetsGallery/JSDemos/images/employees/06.png',
name: data.data.name,
};
this._user = { ...defaultUser };
return {
isOk: true,
data: this._user
};
} else {
//--- jika gagal munculkan pesan gagal
return {
isOk: false,
message: "Authentication failed"
};
}
}
catch {
return {