Skip to content

Commit

Permalink
fix message when leave workshop (#774)
Browse files Browse the repository at this point in the history
* fix message when leave workshop

* fix

* fix

* add enum
  • Loading branch information
Olya-web7 authored Jan 18, 2022
1 parent 96441e2 commit d902a4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
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

0 comments on commit d902a4b

Please sign in to comment.