oidc: Handle login without redirect from backend and set some default
ttls
This commit is contained in:
@@ -68,15 +68,17 @@ document.getElementById('loginForm').addEventListener('submit', function (event)
|
||||
};
|
||||
|
||||
fetch(apiUrl, {
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers: { 'Content-type': 'application/json; charset=UTF-8' }
|
||||
}).then(function (response) {
|
||||
if (response.ok) return response.json();
|
||||
return Promise.reject(response);
|
||||
}).then(function (data) {
|
||||
console.log('login success', data);
|
||||
if (data.redirectTo) window.location.href = data.redirectTo;
|
||||
else console.log('login success but missing redirectTo in data:', data);
|
||||
}).catch(function (error) {
|
||||
if (error.status === 401) document.getElementById('inputPassword').value = ''
|
||||
console.warn('Something went wrong.', error);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user