mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-31 11:32:15 +00:00
* feat: console frontend * chore(dependabot): cycle and npm * chore: rename citadel to zitadel, remove generated files * chore: delete go files * chore(frontend): ci steps * chore: remove docker and envoy files * chore: remove docker file * chore: working dir * chore: run proto build * add console start * chore: restructure folders * chore: remove gui build * statikFs * generate proto for console * add statik import * import * chore: try statik * chore: path * chore: path * chore: script in root * chore: order build steps * chore: go get * chore: folder traversal * chore: non empty test file * chore: gitignore * chore: gitignore * chore: statik path * chore: switch to failing FE build * fix: build * fix: project-grant-test * fix: rm test * add statik.go * go mod tidy * chore: place test, seperate test from build * chore: lint all the world * chore: ci the world instead * chore: tune docker * chore: undo container test * chore: fix run * chore: docker build * chore: test docker build * chore: go build flags * finaly * fix caos_local * go mod Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: Max Peintner <[email protected]>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { OAuthStorage } from 'angular-oauth2-oidc';
|
|
|
|
import { GrpcService } from './grpc.service';
|
|
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
|
|
export class StorageService implements OAuthStorage {
|
|
private storage: Storage = window.sessionStorage;
|
|
|
|
constructor(private grpcService: GrpcService) { }
|
|
|
|
public setItem<TValue = string>(key: string, value: TValue): void {
|
|
this.storage.setItem(this.getPrefixedKey(key), JSON.stringify(value));
|
|
}
|
|
|
|
public getItem<TResult = string>(key: string): TResult | null {
|
|
const result = this.storage.getItem(this.getPrefixedKey(key));
|
|
if (result) {
|
|
return JSON.parse(result);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public removeItem(key: string): void {
|
|
this.storage.removeItem(this.getPrefixedKey(key));
|
|
}
|
|
|
|
public getPrefixedKey(key: string): string {
|
|
return `caos:${key}`;
|
|
}
|
|
}
|
|
|
|
export class StorageConfig {
|
|
clientId: string = '';
|
|
storage: Storage = window.sessionStorage;
|
|
}
|
|
|
|
export enum StorageKey {
|
|
organization = 'organization',
|
|
}
|