The user now has the ability to load more gifs | added a menu to the main chat-page to choose between the search tab and the chat list

This commit is contained in:
joschuatonn
2024-05-09 17:42:53 +02:00
parent 31240e9032
commit 50dea58b5a
5 changed files with 238 additions and 80 deletions

View File

@@ -12,15 +12,15 @@ export const useTenorStore = defineStore('tenorStore', {
},
actions: {
getGifsBySearchTerm(searchTerm : string) {
this.loadGifsBySearchTerm(searchTerm).then((response : any) => {
getGifsBySearchTerm(searchTerm : string, amount : number) {
this.loadGifsBySearchTerm(searchTerm, amount).then((response : any) => {
this.gifs = response.data.results;
this.gifsLoaded = true;
console.log(this.gifsLoaded + " / from store");
});
},
async loadGifsBySearchTerm(searchTerm : string) : Promise<any> {
return await api.get("https://tenor.googleapis.com/v2/search?q="+searchTerm+"&key=AIzaSyBXsUPCjnmjXwcdqMLsyhrH1zm_6VYH_fY&client_key=praxistransferProjekt&limit=10");
async loadGifsBySearchTerm(searchTerm : string, amount : number) : Promise<any> {
return await api.get("https://tenor.googleapis.com/v2/search?q="+searchTerm+"&key=AIzaSyBXsUPCjnmjXwcdqMLsyhrH1zm_6VYH_fY&client_key=praxistransferProjekt&limit="+amount);
}
},
});

View File

@@ -7,6 +7,8 @@ export const useUserStore = defineStore('userStore', {
state: () => ({
user: {"keycloakID":null,"firstName":null,"lastName":null,"username":null},
userLoaded: false,
users: [] as ptpUser[],
usersLoaded: false,
}),
getters: {
@@ -22,5 +24,14 @@ export const useUserStore = defineStore('userStore', {
async loadPtpUsersByKeycloakID(keycloakID : string) : Promise<responseModel> {
return (await api.get("/users/login/"+keycloakID)).data;
},
getAllPtpUsers() {
this.loadAllPtpUsers().then((response : ptpUser[]) => {
this.users = response;
this.usersLoaded = true;
})
},
async loadAllPtpUsers() {
return (await api.get("/users/user")).data;
}
},
});