mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-10 17:38:41 +00:00
29 lines
725 B
JavaScript
29 lines
725 B
JavaScript
import { UriFactory } from '../../../Uri/UriFactory.js';
|
|
|
|
/**
|
|
* Redirect.
|
|
*
|
|
* @param {Object} action Action data
|
|
* @param {function} callback Callback
|
|
* @param {string} id Action element
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
export function redirectMessage (action, callback, id)
|
|
{
|
|
setTimeout(function ()
|
|
{
|
|
const url = action.uri === '' ? '' : UriFactory.build(action.uri);
|
|
|
|
if (action.src) {
|
|
document.getElementById(action.src).src = url;
|
|
} else {
|
|
if (url === window.location.href || url === '') {
|
|
document.location.reload();
|
|
} else {
|
|
window.location.href = url;
|
|
}
|
|
}
|
|
}, parseInt(action.delay));
|
|
};
|