-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat: git mod - updating redux slice and adding pending actions #37830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const checkoutBranchInitAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.checkoutBranch.loading = true; | ||
| state.apiResponses.checkoutBranch.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const checkoutBranchSuccessAction = createSingleArtifactAction( | ||
| (state) => { | ||
| state.apiResponses.checkoutBranch.loading = false; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const checkoutBranchErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.checkoutBranch.loading = false; | ||
| state.apiResponses.checkoutBranch.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,14 @@ import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction | |
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const commitInitAction = createSingleArtifactAction((state) => { | ||
| state.commit.loading = true; | ||
| state.commit.error = null; | ||
| state.apiResponses.commit.loading = true; | ||
| state.apiResponses.commit.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const commitSuccessAction = createSingleArtifactAction((state) => { | ||
| state.commit.loading = false; | ||
| state.apiResponses.commit.loading = false; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
@@ -18,8 +18,8 @@ export const commitErrorAction = createSingleArtifactAction( | |
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we put
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| const { error } = action.payload; | ||
|
|
||
| state.commit.loading = false; | ||
| state.commit.error = error; | ||
| state.apiResponses.commit.loading = false; | ||
| state.apiResponses.commit.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const createBranchInitAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.createBranch.loading = true; | ||
| state.apiResponses.createBranch.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const createBranchSuccessAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.createBranch.loading = false; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const createBranchErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.createBranch.loading = false; | ||
| state.apiResponses.createBranch.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const deleteBranchInitAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.deleteBranch.loading = true; | ||
| state.apiResponses.deleteBranch.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const deleteBranchSuccessAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.deleteBranch.loading = false; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const deleteBranchErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.deleteBranch.loading = false; | ||
| state.apiResponses.deleteBranch.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const discardInitAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.discard.loading = true; | ||
| state.apiResponses.discard.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const discardSuccessAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.discard.loading = false; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const discardErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.discard.loading = false; | ||
| state.apiResponses.discard.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
| import type { GitArtifactPayloadAction } from "../types"; | ||
|
|
||
| export const disconnectInitAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.disconnect.loading = true; | ||
| state.apiResponses.disconnect.error = null; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const disconnectSuccessAction = createSingleArtifactAction((state) => { | ||
| state.apiResponses.disconnect.loading = false; | ||
|
|
||
| return state; | ||
| }); | ||
|
|
||
| export const disconnectErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.disconnect.loading = false; | ||
| state.apiResponses.disconnect.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import type { GitArtifactPayloadAction, GitAutocommitProgress } from "../types"; | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
|
|
||
| export const fetchAutocommitProgressInitAction = createSingleArtifactAction( | ||
| (state) => { | ||
| state.apiResponses.autocommitProgress.loading = true; | ||
| state.apiResponses.autocommitProgress.error = null; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchAutocommitProgressSuccessAction = createSingleArtifactAction( | ||
| ( | ||
| state, | ||
| action: GitArtifactPayloadAction<{ | ||
| autocommitProgress: GitAutocommitProgress; | ||
| }>, | ||
| ) => { | ||
| state.apiResponses.autocommitProgress.loading = false; | ||
| state.apiResponses.autocommitProgress.value = | ||
| action.payload.autocommitProgress; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchAutocommitProgressErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.autocommitProgress.loading = false; | ||
| state.apiResponses.autocommitProgress.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { GitArtifactPayloadAction, GitGlobalConfig } from "../types"; | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
|
|
||
| export const fetchGlobalConfigInitAction = createSingleArtifactAction( | ||
| (state) => { | ||
| state.apiResponses.globalConfig.loading = true; | ||
| state.apiResponses.globalConfig.error = null; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchGlobalConfigSuccessAction = createSingleArtifactAction( | ||
| ( | ||
| state, | ||
| action: GitArtifactPayloadAction<{ globalConfig: GitGlobalConfig }>, | ||
| ) => { | ||
| state.apiResponses.globalConfig.loading = false; | ||
| state.apiResponses.globalConfig.value = action.payload.globalConfig; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchGlobalConfigErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.globalConfig.loading = false; | ||
| state.apiResponses.globalConfig.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { GitArtifactPayloadAction, GitLocalConfig } from "../types"; | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
|
|
||
| export const fetchLocalConfigInitAction = createSingleArtifactAction( | ||
| (state) => { | ||
| state.apiResponses.localConfig.loading = true; | ||
| state.apiResponses.localConfig.error = null; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchLocalConfigSuccessAction = createSingleArtifactAction( | ||
| ( | ||
| state, | ||
| action: GitArtifactPayloadAction<{ localConfig: GitLocalConfig }>, | ||
| ) => { | ||
| state.apiResponses.localConfig.loading = false; | ||
| state.apiResponses.localConfig.value = action.payload.localConfig; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
brayn003 marked this conversation as resolved.
|
||
|
|
||
| export const fetchLocalConfigErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.localConfig.loading = false; | ||
| state.apiResponses.localConfig.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
brayn003 marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { GitArtifactPayloadAction, GitMergeStatus } from "../types"; | ||
| import { createSingleArtifactAction } from "./helpers/createSingleArtifactAction"; | ||
|
|
||
| export const fetchMergeStatusInitAction = createSingleArtifactAction( | ||
| (state) => { | ||
| state.apiResponses.mergeStatus.loading = true; | ||
| state.apiResponses.mergeStatus.error = null; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchMergeStatusSuccessAction = createSingleArtifactAction( | ||
| ( | ||
| state, | ||
| action: GitArtifactPayloadAction<{ mergeStatus: GitMergeStatus }>, | ||
| ) => { | ||
| state.apiResponses.mergeStatus.loading = false; | ||
| state.apiResponses.mergeStatus.value = action.payload.mergeStatus; | ||
|
|
||
| return state; | ||
| }, | ||
| ); | ||
|
|
||
| export const fetchMergeStatusErrorAction = createSingleArtifactAction( | ||
| (state, action: GitArtifactPayloadAction<{ error: string }>) => { | ||
| const { error } = action.payload; | ||
|
|
||
| state.apiResponses.mergeStatus.loading = false; | ||
| state.apiResponses.mergeStatus.error = error; | ||
|
|
||
| return state; | ||
| }, | ||
| ); |
Uh oh!
There was an error while loading. Please reload this page.