web/admin: fix state issue after clearIcon/Background is used and for… (#5423)
web/admin: fix state issue after clearIcon/Background is used and form is re-used Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -31,15 +31,13 @@ import {
 | 
			
		||||
 | 
			
		||||
@customElement("ak-source-oauth-form")
 | 
			
		||||
export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
 | 
			
		||||
    loadInstance(pk: string): Promise<OAuthSource> {
 | 
			
		||||
        return new SourcesApi(DEFAULT_CONFIG)
 | 
			
		||||
            .sourcesOauthRetrieve({
 | 
			
		||||
                slug: pk,
 | 
			
		||||
            })
 | 
			
		||||
            .then((source) => {
 | 
			
		||||
                this.providerType = source.type;
 | 
			
		||||
                return source;
 | 
			
		||||
            });
 | 
			
		||||
    async loadInstance(pk: string): Promise<OAuthSource> {
 | 
			
		||||
        const source = await new SourcesApi(DEFAULT_CONFIG).sourcesOauthRetrieve({
 | 
			
		||||
            slug: pk,
 | 
			
		||||
        });
 | 
			
		||||
        this.providerType = source.type;
 | 
			
		||||
        this.clearIcon = false;
 | 
			
		||||
        return source;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _modelName?: string;
 | 
			
		||||
 | 
			
		||||
@ -28,16 +28,14 @@ import {
 | 
			
		||||
 | 
			
		||||
@customElement("ak-source-plex-form")
 | 
			
		||||
export class PlexSourceForm extends ModelForm<PlexSource, string> {
 | 
			
		||||
    loadInstance(pk: string): Promise<PlexSource> {
 | 
			
		||||
        return new SourcesApi(DEFAULT_CONFIG)
 | 
			
		||||
            .sourcesPlexRetrieve({
 | 
			
		||||
                slug: pk,
 | 
			
		||||
            })
 | 
			
		||||
            .then((source) => {
 | 
			
		||||
                this.plexToken = source.plexToken;
 | 
			
		||||
                this.loadServers();
 | 
			
		||||
                return source;
 | 
			
		||||
            });
 | 
			
		||||
    async loadInstance(pk: string): Promise<PlexSource> {
 | 
			
		||||
        const source = await new SourcesApi(DEFAULT_CONFIG).sourcesPlexRetrieve({
 | 
			
		||||
            slug: pk,
 | 
			
		||||
        });
 | 
			
		||||
        this.plexToken = source.plexToken;
 | 
			
		||||
        this.loadServers();
 | 
			
		||||
        this.clearIcon = false;
 | 
			
		||||
        return source;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @state()
 | 
			
		||||
 | 
			
		||||
@ -38,10 +38,12 @@ export class SAMLSourceForm extends ModelForm<SAMLSource, string> {
 | 
			
		||||
    @state()
 | 
			
		||||
    clearIcon = false;
 | 
			
		||||
 | 
			
		||||
    loadInstance(pk: string): Promise<SAMLSource> {
 | 
			
		||||
        return new SourcesApi(DEFAULT_CONFIG).sourcesSamlRetrieve({
 | 
			
		||||
    async loadInstance(pk: string): Promise<SAMLSource> {
 | 
			
		||||
        const source = await new SourcesApi(DEFAULT_CONFIG).sourcesSamlRetrieve({
 | 
			
		||||
            slug: pk,
 | 
			
		||||
        });
 | 
			
		||||
        this.clearIcon = false;
 | 
			
		||||
        return source;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getSuccessMessage(): string {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user