onasty/web/src/interop.js (view raw)
Smirnov Oleksandr
Smirnov Oleksandr
ss2316544@gmail.com refactor(web): make use of types for handling auth (#137)..., 11 months ago
ss2316544@gmail.com refactor(web): make use of types for handling auth (#137)..., 11 months ago
| 1 | import "./styles.css"; |
| 2 | |
| 3 | export const flags = (_) => { |
| 4 | return { |
| 5 | access_token: JSON.parse(window.localStorage.access_token || "null"), |
| 6 | refresh_token: JSON.parse(window.localStorage.refresh_token || "null"), |
| 7 | }; |
| 8 | }; |
| 9 | |
| 10 | export const onReady = ({ app }) => { |
| 11 | if (app.ports?.sendToLocalStorage) { |
| 12 | app.ports.sendToLocalStorage.subscribe(({ key, value }) => { |
| 13 | window.localStorage[key] = JSON.stringify(value); |
| 14 | }); |
| 15 | } |
| 16 | }; |