Archived
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import { createReducer, on } from '@ngrx/store';
|
|
import { receivedAllIssuesSuccessAction } from '../actions/issue.actions';
|
|
import { IssueState } from '../state/issue.state';
|
|
|
|
const initialState: IssueState = {
|
|
issues: [
|
|
{
|
|
id: '1',
|
|
cords: [18.57187, 54.40984],
|
|
title: 'Dziura w drodze na Oliwi',
|
|
createdAt: new Date(),
|
|
description: 'Wielka dziura',
|
|
photos: [],
|
|
status: 'new',
|
|
type: 'problem',
|
|
comments: [
|
|
{
|
|
content: 'Bardzo poważny problem',
|
|
createdAt: new Date(),
|
|
userName: 'user123',
|
|
},
|
|
{
|
|
content: 'Bardzo OGROMNY problem',
|
|
createdAt: new Date(),
|
|
userName: 'user123',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: '2',
|
|
cords: [18.58080765011577, 54.41806822519011],
|
|
title: 'Dziura w drodze na Żabiance',
|
|
createdAt: new Date(),
|
|
description: 'Wielka dziura',
|
|
photos: [],
|
|
status: 'new',
|
|
type: 'problem',
|
|
solution: {
|
|
comments: [],
|
|
createdAt: new Date(),
|
|
description: "eoooo",
|
|
title: "title"
|
|
},
|
|
comments: [],
|
|
},
|
|
{
|
|
id: '3',
|
|
cords: [18.611836200396905, 54.405856587640585],
|
|
title: 'Dziura w drodze na Nigdzie',
|
|
createdAt: new Date(),
|
|
description: 'Wielka dziura',
|
|
photos: [],
|
|
status: 'new',
|
|
type: 'problem',
|
|
comments: [],
|
|
},
|
|
],
|
|
};
|
|
|
|
export const issueReducer = createReducer(
|
|
initialState,
|
|
on(receivedAllIssuesSuccessAction, (state: IssueState, action) => ({
|
|
issues: action.issues,
|
|
}))
|
|
);
|