Refactor & Clean up
This commit is contained in:
parent
ba845f5218
commit
60ef3e3563
154 changed files with 438 additions and 481 deletions
|
|
@ -291,7 +291,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
surrender() {
|
||||
(this as any).api('games/reversi/games/surrender', {
|
||||
this.$root.api('games/reversi/games/surrender', {
|
||||
gameId: this.game.id
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default Vue.extend({
|
|||
},
|
||||
created() {
|
||||
this.g = this.game;
|
||||
this.connection = (this as any).os.stream.connectToChannel('gamesReversiGame', {
|
||||
this.connection = this.$root.stream.connectToChannel('gamesReversiGame', {
|
||||
gameId: this.game.id
|
||||
});
|
||||
this.connection.on('started', this.onStarted);
|
||||
|
|
|
|||
|
|
@ -67,22 +67,22 @@ export default Vue.extend({
|
|||
|
||||
mounted() {
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('gamesReversi');
|
||||
this.connection = this.$root.stream.useSharedConnection('gamesReversi');
|
||||
|
||||
this.connection.on('invited', this.onInvited);
|
||||
|
||||
(this as any).api('games/reversi/games', {
|
||||
this.$root.api('games/reversi/games', {
|
||||
my: true
|
||||
}).then(games => {
|
||||
this.myGames = games;
|
||||
});
|
||||
|
||||
(this as any).api('games/reversi/invitations').then(invitations => {
|
||||
this.$root.api('games/reversi/invitations').then(invitations => {
|
||||
this.invitations = this.invitations.concat(invitations);
|
||||
});
|
||||
}
|
||||
|
||||
(this as any).api('games/reversi/games').then(games => {
|
||||
this.$root.api('games/reversi/games').then(games => {
|
||||
this.games = games;
|
||||
this.gamesFetching = false;
|
||||
});
|
||||
|
|
@ -103,10 +103,10 @@ export default Vue.extend({
|
|||
(this as any).apis.input({
|
||||
title: this.$t('enter-username')
|
||||
}).then(username => {
|
||||
(this as any).api('users/show', {
|
||||
this.$root.api('users/show', {
|
||||
username
|
||||
}).then(user => {
|
||||
(this as any).api('games/reversi/match', {
|
||||
this.$root.api('games/reversi/match', {
|
||||
userId: user.id
|
||||
}).then(res => {
|
||||
if (res == null) {
|
||||
|
|
@ -120,7 +120,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
accept(invitation) {
|
||||
(this as any).api('games/reversi/match', {
|
||||
this.$root.api('games/reversi/match', {
|
||||
userId: invitation.parent.id
|
||||
}).then(game => {
|
||||
if (game) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default Vue.extend({
|
|||
this.fetch();
|
||||
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('gamesReversi');
|
||||
this.connection = this.$root.stream.useSharedConnection('gamesReversi');
|
||||
|
||||
this.connection.on('matched', this.onMatched);
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ export default Vue.extend({
|
|||
this.game = null;
|
||||
} else {
|
||||
Progress.start();
|
||||
(this as any).api('games/reversi/games/show', {
|
||||
this.$root.api('games/reversi/games/show', {
|
||||
gameId: this.gameId
|
||||
}).then(game => {
|
||||
this.game = game;
|
||||
|
|
@ -107,7 +107,7 @@ export default Vue.extend({
|
|||
if (this.selfNav) {
|
||||
// 受け取ったゲーム情報が省略されたものなら完全な情報を取得する
|
||||
if (game != null && (game.settings == null || game.settings.map == null)) {
|
||||
game = await (this as any).api('games/reversi/games/show', {
|
||||
game = await this.$root.api('games/reversi/games/show', {
|
||||
gameId: game.id
|
||||
});
|
||||
}
|
||||
|
|
@ -124,11 +124,11 @@ export default Vue.extend({
|
|||
|
||||
cancel() {
|
||||
this.matching = null;
|
||||
(this as any).api('games/reversi/match/cancel');
|
||||
this.$root.api('games/reversi/match/cancel');
|
||||
},
|
||||
|
||||
accept(invitation) {
|
||||
(this as any).api('games/reversi/match', {
|
||||
this.$root.api('games/reversi/match', {
|
||||
userId: invitation.parent.id
|
||||
}).then(game => {
|
||||
if (game) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue