Merge branch 'new-package' of git.plannaplan.pl:y0rune/frontend into new-package
This commit is contained in:
commit
4c2820d3b8
36
.gitlab-ci.yml
Normal file
36
.gitlab-ci.yml
Normal file
@ -0,0 +1,36 @@
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
||||
build:
|
||||
stage: build
|
||||
image: node
|
||||
script:
|
||||
- echo "Start building App"
|
||||
- npm install typescript eslint
|
||||
- npm install
|
||||
- npm run build
|
||||
- echo "Build successfully!"
|
||||
artifacts:
|
||||
expire_in: 1 hour
|
||||
paths:
|
||||
- build
|
||||
- node_modules/
|
||||
|
||||
test:
|
||||
stage: test
|
||||
image: node
|
||||
script:
|
||||
- echo "Testing App"
|
||||
- CI=true npm test --passWithNoTests
|
||||
- echo "Test successfully!"
|
||||
|
||||
deploy_production:
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "Deploying to server"
|
||||
- rsync --progress -r build/* --delete root@35.207.132.68:/var/www/plannaplan.pl
|
||||
- echo "Deployed"
|
||||
only:
|
||||
- master
|
@ -75,14 +75,15 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const { data } = await axios.get<Array<{ id: string; name: string; groups: Array<Group> }>>(
|
||||
const { data } = await axios.get<Array<{ id: number; name: string; lectures: Array<Group>, classes:Array<Group> }>>(
|
||||
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
||||
);
|
||||
const courses = data.map(({ id, name, groups }) => ({
|
||||
id: parseInt(id),
|
||||
name,
|
||||
lectures: groups.filter(({ type }) => type === GroupType.LECTURE),
|
||||
classes: groups.filter(({ type }) => type === GroupType.CLASS),
|
||||
console.log(data);
|
||||
const courses = data.map(({ id, name, lectures, classes }) => ({
|
||||
id,
|
||||
name,
|
||||
lectures,
|
||||
classes,
|
||||
})) as Array<Course>;
|
||||
courses.sort((a: Course, b: Course) => (a.name > b.name ? 1 : -1));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user