Skip to content

Commit

Permalink
feat(frontend): usage apiの実装
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid committed Nov 2, 2024
1 parent 8c96ced commit 0b22cf4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/frontend/src/components/global/MkAd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { ref, computed } from 'vue';
import { ref, computed, onActivated } from 'vue';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { url as local, host } from '@/config.js';
Expand Down Expand Up @@ -123,6 +123,11 @@ function reduceFrequency(): void {
chosen.value = choseAd();
showMenu.value = false;
}

onActivated(() => {
if (chosen.value == null) return;
fetch(`/api/usage?ad=${chosen.value.id}`, { method: 'POST' });
});
</script>

<style lang="scss" module>
Expand Down

0 comments on commit 0b22cf4

Please sign in to comment.