toasts
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
const toast = require('izitoast');
|
||||
|
||||
function registerEvents(registry, events) {
|
||||
function setCryps(cryps) {
|
||||
console.log('setting cryps');
|
||||
|
||||
+33
-4
@@ -1,14 +1,13 @@
|
||||
const { toast } = require('bulma-toast');
|
||||
const toast = require('izitoast');
|
||||
const cbor = require('borc');
|
||||
|
||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://cryps.gg/ws' : 'ws://localhost:40000';
|
||||
|
||||
function errorToast(err) {
|
||||
console.error(err);
|
||||
return toast({
|
||||
return toast.error({
|
||||
title: 'Error',
|
||||
message: err,
|
||||
type: 'is-warning',
|
||||
duration: 5000,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,6 +39,36 @@ function createSocket(events) {
|
||||
|
||||
// Connection opened
|
||||
ws.addEventListener('open', (event) => {
|
||||
// toast.info({
|
||||
// message: 'connected',
|
||||
// });
|
||||
|
||||
iziToast.question({
|
||||
drag: false,
|
||||
close: false,
|
||||
overlay: true,
|
||||
title: 'Login',
|
||||
message: 'Enter login details',
|
||||
position: 'center',
|
||||
inputs: [
|
||||
['<input type="text">', 'keyup', function (instance, toast, input, e) {
|
||||
console.info(input.value);
|
||||
}, true], // true to focus
|
||||
['<input type="text">', 'change', function (instance, toast, select, e) {
|
||||
console.info(select.options[select.selectedIndex].value);
|
||||
}]
|
||||
],
|
||||
buttons: [
|
||||
['<button><b>Confirm</b></button>', function (instance, toast, button, e, inputs) {
|
||||
|
||||
alert('First field: ' + inputs[0].value)
|
||||
alert('Second field: ' + inputs[1].options[inputs[1].selectedIndex].value)
|
||||
|
||||
instance.hide({ transitionOut: 'fadeOut' }, toast, 'button');
|
||||
}, false], // true to focus
|
||||
]
|
||||
});
|
||||
|
||||
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user