-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Display & regenerate module & environment token value in UI
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<script lang="ts"> | ||
export let label; | ||
export let type = 'button'; | ||
export let label: string; | ||
export let type: "button" | "submit" | "reset" = 'button'; | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
export let onClickAction: () => void = () => { } | ||
</script> | ||
|
||
<button {type}>{label}</button> | ||
<button {type} on:click={onClickAction}>{label}</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type ModuleEnvironmentToken = { | ||
tokenValue: string | ||
} |
17 changes: 17 additions & 0 deletions
17
modules/ui/src/lib/services/ModuleEnvironmentTokenService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type {ModuleEnvironmentToken} from '$lib/domain/ModuleEnvironmentToken'; | ||
import {Http} from '$lib/services/utils/HttpService'; | ||
|
||
export class ModuleEnvironmentTokenService { | ||
private static baseUrl = '/api/v1/moduleEnvironmentTokens'; | ||
|
||
public static byModuleAndEnvironment = async (moduleRef: string, environmentRef: string): Promise<ModuleEnvironmentToken> => { | ||
return Http.get<ModuleEnvironmentToken>(`${ModuleEnvironmentTokenService.baseUrl}/byModuleAndEnvironmentRef/${moduleRef}/${environmentRef}`); | ||
} | ||
|
||
public static regenerateToken = async (moduleRef: string, environmentRef: string): Promise<ModuleEnvironmentToken> => { | ||
return Http.post<ModuleEnvironmentToken>(`${ModuleEnvironmentTokenService.baseUrl}/regenerateToken`, { | ||
moduleRef: moduleRef, | ||
environmentRef: environmentRef | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters