From 466d03a38cb01e9ff9a2d11be113a81c2bdce34a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 25 Jan 2024 20:40:16 +0100 Subject: initial commit --- mobile/app/main-view-model.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 mobile/app/main-view-model.ts (limited to 'mobile/app/main-view-model.ts') diff --git a/mobile/app/main-view-model.ts b/mobile/app/main-view-model.ts new file mode 100644 index 0000000..714abe1 --- /dev/null +++ b/mobile/app/main-view-model.ts @@ -0,0 +1,29 @@ +import { Frame, Http, Observable } from '@nativescript/core'; + +export class LoginModel extends Observable { + public server: string = 'http://192.168.178.59:8080'; + public username: string; + public password: string; + + constructor() { + super(); + } + + async onLogin() { + const content = new FormData(); + content.append('username', this.username); + content.append('password', this.password); + const response = await Http.request({ + url: this.server, + method: 'POST', + content: content, + }); + + console.log(response.content?.toString()); + } + + goToGalleries() { + const frame = Frame.topmost(); + frame.navigate('gallery-page'); + } +} -- cgit v1.2.3