game_url is added
This commit is contained in:
parent
279ec0f1fe
commit
e72efd9f51
|
@ -19,8 +19,18 @@ export class GameMainComponent implements OnInit {
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.__activatedRoute.queryParams.subscribe((params) => {
|
this.__activatedRoute.queryParams.subscribe((params) => {
|
||||||
console.log(params); // { orderby: "price" }
|
console.log(params); // { orderby: "price" }
|
||||||
const vendor_key = params['vendor_key'];
|
const vendorKey = params['vendor_key'];
|
||||||
const game_key = params['game_key'];
|
const gameKey = params['game_key'];
|
||||||
|
|
||||||
|
let r = this.__gameService
|
||||||
|
.getGameUrl(vendorKey, gameKey)
|
||||||
|
.then((r) => {
|
||||||
|
console.log('success', r.getUrl());
|
||||||
|
window.location.href = r.getUrl();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log('fail', e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,10 +4,15 @@ import { NatsService } from 'app/core/nats/services/nats.service';
|
||||||
import { Error } from 'app/modules/proto/protobuf/rpc_pb';
|
import { Error } from 'app/modules/proto/protobuf/rpc_pb';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
GetGameUrlRequest,
|
||||||
|
GetGameUrlResponse,
|
||||||
ListGamesRequest,
|
ListGamesRequest,
|
||||||
ListGamesResponse,
|
ListGamesResponse,
|
||||||
} from 'app/modules/proto/c2se/api/game_pb';
|
} from 'app/modules/proto/c2se/api/game_pb';
|
||||||
import { SUBJECT_LIST_GAMES } from 'app/modules/proto/c2se/frontend/api/game_pb';
|
import {
|
||||||
|
SUBJECT_GET_GAME_URL,
|
||||||
|
SUBJECT_LIST_GAMES,
|
||||||
|
} from 'app/modules/proto/c2se/frontend/api/game_pb';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
@ -49,4 +54,30 @@ export class GameService {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getGameUrl(
|
||||||
|
vendorKey: string,
|
||||||
|
gameKey: string
|
||||||
|
): Promise<GetGameUrlResponse.Result> {
|
||||||
|
return new Promise<GetGameUrlResponse.Result>((resolve, reject) => {
|
||||||
|
let req = new GetGameUrlRequest();
|
||||||
|
req.setVendorKey(vendorKey);
|
||||||
|
req.setGameKey(gameKey);
|
||||||
|
|
||||||
|
this.__natsService
|
||||||
|
.request<GetGameUrlResponse.Result>(
|
||||||
|
SUBJECT_GET_GAME_URL,
|
||||||
|
req.serializeBinary(),
|
||||||
|
GetGameUrlResponse.deserializeBinary
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
|
console.log('success', result);
|
||||||
|
return resolve(result);
|
||||||
|
})
|
||||||
|
.catch((e: Error) => {
|
||||||
|
console.log('failed', e);
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user