Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Tabu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Tabu
Commits
ea8eddf9
Commit
ea8eddf9
authored
Dec 28, 2020
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Request isSpielSession and toggle buttons if game exist
parent
3da4c57a
Pipeline
#281
passed with stages
in 5 minutes and 12 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
TabuMiddlewareService.ts
src/app/dao/TabuMiddlewareService.ts
+5
-0
select-game.component.html
src/app/select-game/select-game.component.html
+2
-2
select-game.component.ts
src/app/select-game/select-game.component.ts
+20
-3
No files found.
src/app/dao/TabuMiddlewareService.ts
View file @
ea8eddf9
...
@@ -26,6 +26,11 @@ export class TabuMiddlewareService {
...
@@ -26,6 +26,11 @@ export class TabuMiddlewareService {
return
this
.
request
(
'
GET
'
,
`
${
environment
.
tabuMiddlewareURL
}
SpielSession`
);
return
this
.
request
(
'
GET
'
,
`
${
environment
.
tabuMiddlewareURL
}
SpielSession`
);
}
}
isSpielSession
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
'
json:
'
,
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
isSpielSession`
,
req
);
}
addSpielSession
(
event
:
any
):
Promise
<
any
>
{
addSpielSession
(
event
:
any
):
Promise
<
any
>
{
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
addSpielSession`
,
event
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
addSpielSession`
,
event
);
}
}
...
...
src/app/select-game/select-game.component.html
View file @
ea8eddf9
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
</form>
</form>
</mat-card-content>
</mat-card-content>
<mat-card-actions>
<mat-card-actions>
<button
[disabled]=
"button
s
Disabled"
mat-raised-button
color=
"primary"
(click)=
"getSpielSessions()"
>
Spiel erstellen
</button>
<button
[disabled]=
"button
CreateGame
Disabled"
mat-raised-button
color=
"primary"
(click)=
"getSpielSessions()"
>
Spiel erstellen
</button>
<button
[disabled]=
"button
s
Disabled"
mat-raised-button
color=
"primary"
(click)=
"joinGame()"
>
Spiel beitreten
</button>
<button
[disabled]=
"button
JoinGame
Disabled"
mat-raised-button
color=
"primary"
(click)=
"joinGame()"
>
Spiel beitreten
</button>
</mat-card-actions>
</mat-card-actions>
</mat-card>
</mat-card>
</div>
</div>
src/app/select-game/select-game.component.ts
View file @
ea8eddf9
...
@@ -9,7 +9,8 @@ import {TabuMiddlewareService} from '../dao/TabuMiddlewareService';
...
@@ -9,7 +9,8 @@ import {TabuMiddlewareService} from '../dao/TabuMiddlewareService';
})
})
export
class
SelectGameComponent
implements
OnInit
{
export
class
SelectGameComponent
implements
OnInit
{
buttonsDisabled
=
true
;
buttonCreateGameDisabled
=
true
;
buttonJoinGameDisabled
=
true
;
constructor
(
private
router
:
Router
,
constructor
(
private
router
:
Router
,
private
server
:
TabuMiddlewareService
)
{
}
private
server
:
TabuMiddlewareService
)
{
}
...
@@ -36,7 +37,23 @@ export class SelectGameComponent implements OnInit {
...
@@ -36,7 +37,23 @@ export class SelectGameComponent implements OnInit {
}
}
checkSpielname
(
spielname
:
string
):
void
{
checkSpielname
(
spielname
:
string
):
void
{
console
.
log
(
spielname
)
if
(
spielname
.
length
===
0
)
{
this
.
buttonsDisabled
=
spielname
.
length
===
0
;
this
.
buttonCreateGameDisabled
=
true
;
this
.
buttonJoinGameDisabled
=
true
;
return
;
}
else
{
console
.
log
(
spielname
);
this
.
server
.
isSpielSession
({
"
spielname
"
:
''
+
spielname
+
''
}).
then
(
value
=>
{
console
.
log
(
'
Response:
'
,
value
.
status
);
const
status
=
JSON
.
parse
(
value
.
status
);
if
(
status
)
{
this
.
buttonCreateGameDisabled
=
true
;
this
.
buttonJoinGameDisabled
=
false
;
}
else
{
this
.
buttonCreateGameDisabled
=
false
;
this
.
buttonJoinGameDisabled
=
true
;
}
});
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment