Skip to content
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

fix message when leave workshop #774

Merged
merged 5 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/shared/enum/messageBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ export enum messageType {
warningBlue = 'priority_high',
error = 'close',
}

export enum messageStatus {
left = 'Гурток успішно залишено',
approved = 'Статус заявки успішно змінено',
rejected = 'Заявку успішно відхилено'
}
7 changes: 6 additions & 1 deletion src/app/shared/store/user.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ import {
GetAllUsersChildren,
ResetSelectedWorkshop,
} from './user.actions';
import { ApplicationStatus } from '../enum/applications';
import { messageStatus } from '../enum/messageBar';


export interface UserStateModel {
Expand Down Expand Up @@ -480,7 +482,10 @@ export class UserState {

@Action(OnUpdateApplicationSuccess)
onUpdateApplicationSuccess({ dispatch }: StateContext<UserStateModel>, { payload }: OnUpdateApplicationSuccess): void {
dispatch(new ShowMessageBar({ message: 'Статус заявки успішно змінено', type: 'success' }));

dispatch(new ShowMessageBar({ message: payload.status === ApplicationStatus.Left
? messageStatus.left
: messageStatus.approved, type: 'success' }));
dispatch(new GetApplicationsByParentId(payload.parentId));
}
@Action(CreateRating)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ApplicationsComponent extends CabinetDataComponent implements OnIni
* @param Application event
*/
onApprove(application: Application): void {
const applicationUpdate = new ApplicationUpdate(application.id, this.applicationStatus.Approved);
const applicationUpdate = new ApplicationUpdate(application.id, this.applicationStatus.Approved);
this.store.dispatch(new UpdateApplication(applicationUpdate));
}

Expand Down