rename api -> cloud

This commit is contained in:
Nikita Galaiko 2023-05-09 14:12:23 +02:00
parent 3fcdaa2104
commit cf08bb8a24
7 changed files with 19 additions and 19 deletions

View File

@ -6,10 +6,10 @@
import Button from './Button';
export let user: Awaited<ReturnType<typeof users.CurrentUser>>;
export let api: Awaited<ReturnType<typeof CloudApi>>;
export let cloud: Awaited<ReturnType<typeof CloudApi>>;
const pollForUser = async (token: string) => {
const apiUser = await api.login.user.get(token).catch(() => null);
const apiUser = await cloud.login.user.get(token).catch(() => null);
if (apiUser) {
user.set(apiUser);
return apiUser;
@ -25,7 +25,7 @@
const onSignUpOrLoginClick = () => {
Promise.resolve()
.then(() => (signUpOrLoginLoading = true))
.then(api.login.token.create)
.then(cloud.login.token.create)
.then(token.set)
.catch((e) => {
log.error(e);

View File

@ -12,7 +12,7 @@
export let statuses: Record<string, Status>;
export let diffs: Record<string, string>;
export let user: User;
export let api: ReturnType<typeof CloudApi>;
export let cloud: ReturnType<typeof CloudApi>;
let summary = '';
let description = '';
@ -96,7 +96,7 @@
description = '';
isAutowriting = true;
api.summarize
cloud.summarize
.commit(user.access_token, {
diff,
uid: project.id

View File

@ -16,7 +16,7 @@ export const load: LayoutLoad = wrapLoadWithSentry(({ fetch }) => {
return {
projects: api.projects.Projects(),
user: api.users.CurrentUser(),
api: api.CloudApi({ fetch }),
cloud: api.CloudApi({ fetch }),
posthog: Posthog(),
sentry: Sentry(),
events,

View File

@ -11,7 +11,7 @@
import { format } from 'date-fns';
export let data: LayoutData;
const { hotkeys, events, user, api, project, head, statuses, diffs } = data;
const { hotkeys, events, user, cloud, project, head, statuses, diffs } = data;
let query: string;
@ -145,7 +145,7 @@
<QuickCommitModal
bind:this={quickCommitModal}
user={$user}
{api}
{cloud}
project={$project}
head={$head}
diffs={$diffs}

View File

@ -15,7 +15,7 @@
import { unsubscribe } from '$lib/utils';
export let data: PageData;
let { statuses, diffs, user, api, projectId, project, hotkeys } = data;
let { statuses, diffs, user, cloud, projectId, project, hotkeys } = data;
let fullContext = false;
let context = 3;
@ -133,7 +133,7 @@
description = '';
isGeneratingCommitMessage = true;
api.summarize
cloud.summarize
.commit($user.access_token, {
diff,
uid: projectId
@ -182,7 +182,7 @@
try {
if (!$project.api) {
const apiProject = await api.projects.create($user.access_token, {
const apiProject = await cloud.projects.create($user.access_token, {
name: $project.title,
uid: $project.id
});

View File

@ -6,7 +6,7 @@
import { goto } from '$app/navigation';
export let data: PageData;
const { project, user, api } = data;
const { project, user, cloud } = data;
const repo_id = (url: string) => {
const hurl = new URL(url);
@ -30,7 +30,7 @@
try {
if (!$project.api) {
const apiProject = await api.projects.create($user.access_token, {
const apiProject = await cloud.projects.create($user.access_token, {
name: $project.title,
uid: $project.id
});
@ -65,7 +65,7 @@
try {
if (name) {
const updated = await api.projects.update($user.access_token, $project?.api.repository_id, {
const updated = await cloud.projects.update($user.access_token, $project?.api.repository_id, {
name,
description
});
@ -169,7 +169,7 @@
<div class="text-zinc-400">backup your work and access advanced features</div>
</div>
<div class="flex flex-row items-center space-x-2">
<Login {user} {api} />
<Login {user} {cloud} />
</div>
</div>
{/if}

View File

@ -6,7 +6,7 @@
import { goto } from '$app/navigation';
export let data: PageData;
const { user, api } = data;
const { user, cloud } = data;
$: saving = false;
@ -49,7 +49,7 @@
const picture = formData.get('picture') as File | undefined;
try {
$user = await api.user.update($user.access_token, {
$user = await cloud.user.update($user.access_token, {
name: userNameInput,
picture: picture
});
@ -90,7 +90,7 @@
<h2 class="text-2xl font-medium">GitButler Cloud Account</h2>
<div class="">Your online account details on gitbutler.com</div>
</div>
<Login {user} {api} />
<Login {user} {cloud} />
</header>
<form
@ -222,7 +222,7 @@
</li>
</ul>
<div class="mt-8 text-center">
<Login {user} {api} />
<Login {user} {cloud} />
</div>
<div class="text-center text-zinc-300">
You will still need to give us permission for each project before we transfer any data to