aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-11 21:50:51 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-19 21:22:28 +0100
commitfeb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch)
tree2abc9fbc9569760e218fd52835850b757344b420 /client/src/app/shared
parent108626609eda75e4ecc0a83a650a4d53c46220e0 (diff)
downloadPeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz
PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst
PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip
First version with PostgreSQL
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/auth/auth-user.model.ts9
-rw-r--r--client/src/app/shared/search/search-field.type.ts2
-rw-r--r--client/src/app/shared/search/search.component.ts4
-rw-r--r--client/src/app/shared/users/user.model.ts10
4 files changed, 11 insertions, 14 deletions
diff --git a/client/src/app/shared/auth/auth-user.model.ts b/client/src/app/shared/auth/auth-user.model.ts
index bdd5ea5a9..f560351f4 100644
--- a/client/src/app/shared/auth/auth-user.model.ts
+++ b/client/src/app/shared/auth/auth-user.model.ts
@@ -7,9 +7,6 @@ export class AuthUser extends User {
7 USERNAME: 'username' 7 USERNAME: 'username'
8 }; 8 };
9 9
10 id: string;
11 role: string;
12 username: string;
13 tokens: Tokens; 10 tokens: Tokens;
14 11
15 static load() { 12 static load() {
@@ -17,7 +14,7 @@ export class AuthUser extends User {
17 if (usernameLocalStorage) { 14 if (usernameLocalStorage) {
18 return new AuthUser( 15 return new AuthUser(
19 { 16 {
20 id: localStorage.getItem(this.KEYS.ID), 17 id: parseInt(localStorage.getItem(this.KEYS.ID)),
21 username: localStorage.getItem(this.KEYS.USERNAME), 18 username: localStorage.getItem(this.KEYS.USERNAME),
22 role: localStorage.getItem(this.KEYS.ROLE) 19 role: localStorage.getItem(this.KEYS.ROLE)
23 }, 20 },
@@ -35,7 +32,7 @@ export class AuthUser extends User {
35 Tokens.flush(); 32 Tokens.flush();
36 } 33 }
37 34
38 constructor(userHash: { id: string, username: string, role: string }, hashTokens: any) { 35 constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) {
39 super(userHash); 36 super(userHash);
40 this.tokens = new Tokens(hashTokens); 37 this.tokens = new Tokens(hashTokens);
41 } 38 }
@@ -58,7 +55,7 @@ export class AuthUser extends User {
58 } 55 }
59 56
60 save() { 57 save() {
61 localStorage.setItem(AuthUser.KEYS.ID, this.id); 58 localStorage.setItem(AuthUser.KEYS.ID, this.id.toString());
62 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); 59 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username);
63 localStorage.setItem(AuthUser.KEYS.ROLE, this.role); 60 localStorage.setItem(AuthUser.KEYS.ROLE, this.role);
64 this.tokens.save(); 61 this.tokens.save();
diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts
index 5228ee68a..6be584ed1 100644
--- a/client/src/app/shared/search/search-field.type.ts
+++ b/client/src/app/shared/search/search-field.type.ts
@@ -1 +1 @@
export type SearchField = "name" | "author" | "podUrl" | "magnetUri" | "tags"; export type SearchField = "name" | "author" | "host" | "magnetUri" | "tags";
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index b6237469b..9f7e156ec 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -14,8 +14,8 @@ export class SearchComponent implements OnInit {
14 fieldChoices = { 14 fieldChoices = {
15 name: 'Name', 15 name: 'Name',
16 author: 'Author', 16 author: 'Author',
17 podUrl: 'Pod Url', 17 host: 'Pod Host',
18 magnetUri: 'Magnet Uri', 18 magnetUri: 'Magnet URI',
19 tags: 'Tags' 19 tags: 'Tags'
20 }; 20 };
21 searchCriterias: Search = { 21 searchCriterias: Search = {
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 726495d11..52d89e004 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,16 +1,16 @@
1export class User { 1export class User {
2 id: string; 2 id: number;
3 username: string; 3 username: string;
4 role: string; 4 role: string;
5 createdDate: Date; 5 createdAt: Date;
6 6
7 constructor(hash: { id: string, username: string, role: string, createdDate?: Date }) { 7 constructor(hash: { id: number, username: string, role: string, createdAt?: Date }) {
8 this.id = hash.id; 8 this.id = hash.id;
9 this.username = hash.username; 9 this.username = hash.username;
10 this.role = hash.role; 10 this.role = hash.role;
11 11
12 if (hash.createdDate) { 12 if (hash.createdAt) {
13 this.createdDate = hash.createdDate; 13 this.createdAt = hash.createdAt;
14 } 14 }
15 } 15 }
16 16