mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add roadmap management to Site settings (#123)
This commit is contained in:
committed by
GitHub
parent
db674eaf6a
commit
e2065b2c5e
@@ -43,24 +43,34 @@ const postStatusUpdateFailure = (error: string): PostStatusUpdateFailureAction =
|
||||
error,
|
||||
});
|
||||
|
||||
export const updatePostStatus = (
|
||||
id: number,
|
||||
name: string,
|
||||
color: string,
|
||||
authenticityToken: string,
|
||||
): ThunkAction<void, State, null, Action<string>> => async (dispatch) => {
|
||||
interface UpdatePostStatusParams {
|
||||
id: number;
|
||||
name?: string;
|
||||
color?: string;
|
||||
showInRoadmap?: boolean;
|
||||
authenticityToken: string;
|
||||
}
|
||||
|
||||
export const updatePostStatus = ({
|
||||
id,
|
||||
name = null,
|
||||
color = null,
|
||||
showInRoadmap = null,
|
||||
authenticityToken,
|
||||
}: UpdatePostStatusParams): ThunkAction<void, State, null, Action<string>> => async (dispatch) => {
|
||||
dispatch(postStatusUpdateStart());
|
||||
|
||||
const post_status = Object.assign({},
|
||||
name !== null ? {name} : null,
|
||||
color !== null ? {color} : null,
|
||||
showInRoadmap !== null ? {show_in_roadmap: showInRoadmap} : null
|
||||
);
|
||||
|
||||
try {
|
||||
const res = await fetch(`/post_statuses/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: buildRequestHeaders(authenticityToken),
|
||||
body: JSON.stringify({
|
||||
post_status: {
|
||||
name,
|
||||
color,
|
||||
},
|
||||
}),
|
||||
body: JSON.stringify({post_status}),
|
||||
});
|
||||
const json = await res.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user