fix(ui): easier token grabber for dev (#1950)
This commit is contained in:
parent
e1e07dfb9f
commit
f9d915d18a
1 changed files with 17 additions and 1 deletions
|
|
@ -28,8 +28,24 @@ store.subscribe(() => {
|
|||
});
|
||||
});
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
console.log('Copied to clipboard');
|
||||
} catch (err) {
|
||||
console.error('Could not copy text: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.getJWT = () => {
|
||||
console.log(JSON.stringify(storage.state().user?.jwt || 'not logged in'));
|
||||
const jwtToken = storage.state().user?.jwt ? JSON.stringify(storage.state().user?.jwt) : null
|
||||
if (jwtToken) {
|
||||
console.log(jwtToken);
|
||||
void copyToClipboard(jwtToken)
|
||||
} else {
|
||||
console.log('not logged in')
|
||||
}
|
||||
}
|
||||
window.setJWT = (jwt) => {
|
||||
store.dispatch({ type: UPDATE_JWT, data: jwt })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue