mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-05 03:19:52 +08:00
feat(core): add self host team plan (#9569)
This commit is contained in:
@@ -105,7 +105,7 @@ export class LicenseService implements OnModuleInit {
|
||||
throw new WorkspaceLicenseAlreadyExists();
|
||||
}
|
||||
|
||||
const data = await this.fetch<License>(
|
||||
const data = await this.fetchAffinePro<License>(
|
||||
`/api/team/licenses/${licenseKey}/activate`,
|
||||
{
|
||||
method: 'POST',
|
||||
@@ -155,7 +155,7 @@ export class LicenseService implements OnModuleInit {
|
||||
throw new LicenseNotFound();
|
||||
}
|
||||
|
||||
await this.fetch(`/api/team/licenses/${license.key}/deactivate`, {
|
||||
await this.fetchAffinePro(`/api/team/licenses/${license.key}/deactivate`, {
|
||||
method: 'POST',
|
||||
});
|
||||
|
||||
@@ -170,10 +170,11 @@ export class LicenseService implements OnModuleInit {
|
||||
plan: SubscriptionPlan.SelfHostedTeam,
|
||||
recurring: SubscriptionRecurring.Monthly,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
async updateTeamRecurring(key: string, recurring: SubscriptionRecurring) {
|
||||
await this.fetch(`/api/team/licenses/${key}/recurring`, {
|
||||
await this.fetchAffinePro(`/api/team/licenses/${key}/recurring`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
recurring,
|
||||
@@ -192,7 +193,7 @@ export class LicenseService implements OnModuleInit {
|
||||
throw new LicenseNotFound();
|
||||
}
|
||||
|
||||
return this.fetch<{ url: string }>(
|
||||
return this.fetchAffinePro<{ url: string }>(
|
||||
`/api/team/licenses/${license.key}/create-customer-portal`,
|
||||
{
|
||||
method: 'POST',
|
||||
@@ -218,7 +219,7 @@ export class LicenseService implements OnModuleInit {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.fetch(`/api/team/licenses/${license.key}/seats`, {
|
||||
await this.fetchAffinePro(`/api/team/licenses/${license.key}/seats`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
quantity: count,
|
||||
@@ -276,7 +277,7 @@ export class LicenseService implements OnModuleInit {
|
||||
|
||||
private async revalidateLicense(license: InstalledLicense) {
|
||||
try {
|
||||
const res = await this.fetch<License>(
|
||||
const res = await this.fetchAffinePro<License>(
|
||||
`/api/team/licenses/${license.key}/health`,
|
||||
{
|
||||
headers: {
|
||||
@@ -325,7 +326,7 @@ export class LicenseService implements OnModuleInit {
|
||||
}
|
||||
}
|
||||
|
||||
private async fetch<T = any>(
|
||||
private async fetchAffinePro<T = any>(
|
||||
path: string,
|
||||
init?: RequestInit
|
||||
): Promise<T & { res: Response }> {
|
||||
|
||||
Reference in New Issue
Block a user