chore(web): generate API functions with a single argument (#2568)

This commit is contained in:
Sergey Kondrikov
2023-05-28 04:52:22 +03:00
committed by GitHub
parent a460940430
commit 6c6c5ef651
65 changed files with 1913 additions and 491 deletions

View File

@@ -4,7 +4,7 @@ import type { OAuthConfigResponseDto } from '@api';
import type { PageServerLoad } from './$types';
export const load = (async ({ locals: { api } }) => {
const { data } = await api.userApi.getUserCount(true);
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount === 0) {
// Admin not registered
throw redirect(302, AppRoute.AUTH_REGISTER);
@@ -17,7 +17,7 @@ export const load = (async ({ locals: { api } }) => {
try {
// TODO: Figure out how to get correct redirect URI server-side.
const { data } = await api.oauthApi.generateConfig({ redirectUri: '/' });
const { data } = await api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri: '/' } });
data.url = undefined;
authConfig = data;

View File

@@ -2,7 +2,7 @@ import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load = (async ({ locals: { api } }) => {
const { data } = await api.userApi.getUserCount(true);
const { data } = await api.userApi.getUserCount({ admin: true });
if (data.userCount != 0) {
// Admin has been registered, redirect to login
throw redirect(302, '/auth/login');