aboutsummaryrefslogtreecommitdiff
path: root/src/mixins.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-06 20:20:37 -0700
committerFuwn <[email protected]>2021-05-06 20:20:37 -0700
commitdf12123946bbfa0515cb3338f112b931a1bff3c1 (patch)
treea41f897af916417a9b040b599252d4e23a16d658 /src/mixins.ts
parentInitial commit (diff)
downloadfrontend-df12123946bbfa0515cb3338f112b931a1bff3c1.tar.xz
frontend-df12123946bbfa0515cb3338f112b931a1bff3c1.zip
feat(global): :star:
Diffstat (limited to 'src/mixins.ts')
-rw-r--r--src/mixins.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/mixins.ts b/src/mixins.ts
new file mode 100644
index 0000000..bea2fca
--- /dev/null
+++ b/src/mixins.ts
@@ -0,0 +1,47 @@
+import { Options, Vue } from 'vue-class-component';
+
+@Options({})
+export default class APIExtendableLanguage extends Vue {
+ isLoading = true;
+
+ images: any;
+
+ language = '';
+
+ languages: any;
+
+ random: any;
+
+ async fetchImages(): Promise<void> {
+ fetch(`http://localhost/api/v1/language?lang=${this.language}`, {
+ method: 'GET',
+ })
+ .then((response) => response.json())
+ .then((response) => {
+ this.images = response;
+ this.isLoading = false;
+ });
+ }
+
+ async fetchLanguages(): Promise<void> {
+ fetch('http://localhost/api/v1/languages', {
+ method: 'GET',
+ })
+ .then((response) => response.json())
+ .then((response) => {
+ this.languages = response;
+ this.isLoading = false;
+ });
+ }
+
+ async fetchRandom(): Promise<void> {
+ fetch('http://localhost/api/v1/random', {
+ method: 'GET',
+ })
+ .then((response) => response.json())
+ .then((response) => {
+ this.random = response;
+ this.isLoading = false;
+ });
+ }
+}