Merge branch 'master' into feature/defaultFunctionality
This commit is contained in:
26
src/stores/tenor-store.ts
Normal file
26
src/stores/tenor-store.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import {api} from 'boot/axios';
|
||||
import { ptpUser, responseModel, tenorResponseElement } from 'src/models';
|
||||
import Keycloak from 'keycloak-js';
|
||||
|
||||
export const useTenorStore = defineStore('tenorStore', {
|
||||
state: () => ({
|
||||
gifs: [] as Array<tenorResponseElement>,
|
||||
gifsLoaded: false,
|
||||
}),
|
||||
getters: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
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, 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);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -30,6 +30,8 @@ export const useUserStore = defineStore('userStore', {
|
||||
state: () => ({
|
||||
user: null as ptpUser | null,
|
||||
userLoaded: false,
|
||||
users: [] as ptpUser[],
|
||||
usersLoaded: false,
|
||||
keycloak: null as Keycloak | null,
|
||||
id: "",
|
||||
users: [] as ptpUser[],
|
||||
@@ -44,10 +46,18 @@ export const useUserStore = defineStore('userStore', {
|
||||
async loadPtpUsersById(id : string) : Promise<responseModel> {
|
||||
return (await api.get("/users/login/"+id)).data;
|
||||
},
|
||||
async loadAllUsers(): Promise<ptpUser[]> {
|
||||
this.users = (await api.get("/users/user")).data;
|
||||
return this.users;
|
||||
|
||||
getAllPtpUsers() {
|
||||
this.loadAllPtpUsers().then((response : ptpUser[]) => {
|
||||
this.users = response;
|
||||
this.usersLoaded = true;
|
||||
})
|
||||
},
|
||||
|
||||
async loadAllPtpUsers() {
|
||||
return (await api.get("/users/user")).data;
|
||||
},
|
||||
|
||||
async initKeycloak() : Promise<Keycloak>{
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user