Added campaign retrieval function, added banner to homepage.

This commit is contained in:
DebaucheryLibrarian
2022-07-18 02:42:30 +02:00
parent bb055e6ecc
commit cd187fac16
7 changed files with 357 additions and 464 deletions

View File

@@ -227,6 +227,46 @@ function initUiActions(store, _router) {
};
}
async function fetchRandomCampaign(context, { minRatio, maxRatio }) {
const { randomCampaign } = await graphql(`
query Campaign(
$minRatio: BigFloat
$maxRatio: BigFloat
) {
randomCampaign: getRandomCampaign(minRatio: $minRatio, maxRatio: $maxRatio) {
url
affiliate {
url
}
banner {
id
type
ratio
entity {
type
slug
parent {
type
slug
}
}
}
entity {
slug
}
parent {
slug
}
}
}
`, {
minRatio,
maxRatio,
});
return randomCampaign;
}
async function fetchStats() {
const {
scenes,
@@ -273,6 +313,7 @@ function initUiActions(store, _router) {
setBatch,
setSfw,
setTheme,
fetchRandomCampaign,
fetchNotifications,
fetchStats,
};