| 1 |
import { Component, useEffect } from "@odoo/owl"; |
| 2 |
import { CriticalPOSError } from "./critical_pos_error/critical_pos_error"; |
| 3 |
|
| 4 |
export class Loader extends Component { |
| 5 |
static template = "point_of_sale.Loader"; |
| 6 |
static props = { loader: { type: Object, shape: { isShown: Boolean, error: Object } } }; |
| 7 |
static components = { CriticalPOSError }; |
| 8 |
|
| 9 |
setup() { |
| 10 |
useEffect( |
| 11 |
(isShown) => { |
| 12 |
if (!isShown) { |
| 13 |
// Destroy the loader app after it has faded out |
| 14 |
setTimeout(() => { |
| 15 |
this.__owl__.app.destroy(); |
| 16 |
}, 1000); |
| 17 |
} |
| 18 |
}, |
| 19 |
() => [this.props.loader.isShown] |
| 20 |
); |
| 21 |
} |
| 22 |
} |