jsOMS/Model/Action/Dom/Redirect.js
Dennis Eichhorn 7b75ec58f7
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled
fix permissions
2025-04-02 14:15:07 +00:00

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));
};