|
|
@ -1,11 +1,14 @@
|
|
|
|
import matrix from 'matrix-js-sdk';
|
|
|
|
import matrix from 'matrix-js-sdk';
|
|
|
|
|
|
|
|
import Vue from 'vue'
|
|
|
|
import main from '@/main.js';
|
|
|
|
import main from '@/main.js';
|
|
|
|
const matrix_cli = matrix.createClient("https://adb.sh");
|
|
|
|
const matrix_cli = matrix.createClient("https://adb.sh");
|
|
|
|
|
|
|
|
|
|
|
|
let session = {
|
|
|
|
let session = {
|
|
|
|
user: "",
|
|
|
|
user: "",
|
|
|
|
password: "",
|
|
|
|
password: "",
|
|
|
|
access_token: ""
|
|
|
|
access_token: "",
|
|
|
|
|
|
|
|
rooms: [],
|
|
|
|
|
|
|
|
current_room: "open chat"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let rooms = [];
|
|
|
|
let rooms = [];
|
|
|
|
|
|
|
|
|
|
|
@ -29,22 +32,39 @@ export default {
|
|
|
|
main.methods.error(response.error)
|
|
|
|
main.methods.error(response.error)
|
|
|
|
console.log(`login error => ${response.error}`)
|
|
|
|
console.log(`login error => ${response.error}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
main.methods.router({path: "rooms"})
|
|
|
|
main.methods.router({path: "rooms/"})
|
|
|
|
matrix_cli.startClient();
|
|
|
|
matrix_cli.startClient();
|
|
|
|
matrix_cli.once('sync', function (state){
|
|
|
|
matrix_cli.once('sync', function (state){
|
|
|
|
console.log(state)
|
|
|
|
console.log(state)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
matrix_cli.on("event", function(event){
|
|
|
|
|
|
|
|
console.log(event.getType());
|
|
|
|
|
|
|
|
console.log(event);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(()=>{this.getRooms()},5000)
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
/*let i=0;
|
|
|
|
|
|
|
|
let checkRooms = setInterval(()=>{
|
|
|
|
|
|
|
|
rooms = matrix_cli.getRooms()
|
|
|
|
|
|
|
|
console.log("asdasd"+rooms.length)
|
|
|
|
|
|
|
|
if (rooms.length !== 0 || i>10) clearInterval(checkRooms)
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
},500)*/
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getRooms(){
|
|
|
|
getRooms(){
|
|
|
|
rooms = matrix_cli.getRooms()
|
|
|
|
rooms.push(matrix_cli.getRooms())
|
|
|
|
return rooms
|
|
|
|
return rooms
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Vue({
|
|
|
|
|
|
|
|
el: '#roomList',
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
rooms: [],
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matrix_cli.on("event", function(event){
|
|
|
|
|
|
|
|
console.log(event.getType());
|
|
|
|
|
|
|
|
console.log(event);
|
|
|
|
|
|
|
|
session.rooms = matrix_cli.getRooms()
|
|
|
|
|
|
|
|
console.log(session.rooms)
|
|
|
|
|
|
|
|
})
|