30 lines
No EOL
868 B
TypeScript
30 lines
No EOL
868 B
TypeScript
import Controller from "./Controller";
|
|
import UserService from "../services/UserService";
|
|
import HomeViewModel from "../models/home/HomeViewModel";
|
|
import PartyService from "../services/PartyService";
|
|
|
|
export default class HomeController extends Controller {
|
|
public async Index_Get_AllowAnonymous() {
|
|
if (this.session) {
|
|
const user = await UserService.GetUser(this.session.userId);
|
|
if (!user) {
|
|
return this.unauthorised();
|
|
}
|
|
|
|
const parties = await PartyService.GetUserParties(this.session.userId);
|
|
const activeUserParty = await UserService.GetActiveParty(this.session.userId);
|
|
const unlockedBadges = await UserService.LoadUserBadges(this.session.userId);
|
|
|
|
const homeViewModel: HomeViewModel = {
|
|
user,
|
|
parties,
|
|
activeUserParty,
|
|
unlockedBadges
|
|
};
|
|
|
|
return this.view("home", homeViewModel);
|
|
}
|
|
|
|
return this.view();
|
|
}
|
|
} |