diff --git a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
index 734c84f47..2dfe312bc 100644
--- a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
+++ b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.html
@@ -13,7 +13,7 @@
- The schema name becomes part of the api url,
e.g {{apiUrl.buildUrl("api/content/")}}{{appName}}/{{schemaName | async}}/.
+ The schema name becomes part of the api url,
e.g {{apiUrl.buildUrl("api/content/")}}{{ctx.appName}}/{{schemaName | async}}/.
It must contain lower case letters (a-z), numbers and dashes only, and cannot be longer than 40 characters. The name cannot be changed later.
diff --git a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
index 5442c6b70..e59892ed1 100644
--- a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
+++ b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
@@ -5,12 +5,12 @@
* Copyright (c) Sebastian Stehle. All rights reserved
*/
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Output } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import {
ApiUrlConfig,
- AuthService,
+ AppContext,
DateTime,
fadeAnimation,
SchemaDetailsDto,
@@ -24,6 +24,9 @@ const FALLBACK_NAME = 'my-schema';
selector: 'sqx-schema-form',
styleUrls: ['./schema-form.component.scss'],
templateUrl: './schema-form.component.html',
+ providers: [
+ AppContext
+ ],
animations: [
fadeAnimation
]
@@ -35,9 +38,6 @@ export class SchemaFormComponent {
@Output()
public cancelled = new EventEmitter();
- @Input()
- public appName: string;
-
public showImport = false;
public createFormError = '';
@@ -59,9 +59,9 @@ export class SchemaFormComponent {
constructor(
public readonly apiUrl: ApiUrlConfig,
+ public readonly ctx: AppContext,
private readonly schemas: SchemasService,
- private readonly formBuilder: FormBuilder,
- private readonly authService: AuthService
+ private readonly formBuilder: FormBuilder
) {
}
@@ -85,9 +85,7 @@ export class SchemaFormComponent {
const schemaName = this.createForm.controls['name'].value;
const schemaDto = Object.assign(this.createForm.controls['import'].value || {}, { name: schemaName });
- const me = this.authService.user!.token;
-
- this.schemas.postSchema(this.appName, schemaDto, me, DateTime.now())
+ this.schemas.postSchema(this.ctx.appName, schemaDto, this.ctx.userToken, DateTime.now())
.subscribe(dto => {
this.emitCreated(dto);
this.resetCreateForm();