Skip to content

Commit

Permalink
Streaming envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Oct 23, 2023
1 parent f379d94 commit 3570af6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/controllers/gitrepositoryController.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func GitRepositoryController(
if err != nil {
panic(err.Error())
}
fluxStateBytes, err := json.Marshal(fluxState)
fluxStateBytes, err := json.Marshal(streaming.Envelope{
Type: streaming.FLUX_STATE_RECEIVED,
Payload: fluxState,
})
if err != nil {
panic(err.Error())
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/streaming/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package streaming

const (
FLUX_STATE_RECEIVED string = "FLUX_STATE_RECEIVED"
)

type Envelope struct {
Type string `json:"type"`
Payload interface{} `json:"payload"`
}
2 changes: 1 addition & 1 deletion web/src/redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const initialState = {
fluxState: {}
}

export const ACTION_FLUX_STATE_RECEIVED = 'ACTION_FLUX_STATE_RECEIVED';
export const ACTION_FLUX_STATE_RECEIVED = 'FLUX_STATE_RECEIVED';

export function rootReducer(state = initialState, action) {
switch (action.type) {
Expand Down

0 comments on commit 3570af6

Please sign in to comment.