File tree Expand file tree Collapse file tree 1 file changed +44
-3
lines changed Expand file tree Collapse file tree 1 file changed +44
-3
lines changed Original file line number Diff line number Diff line change 5
5
* Created Date: 2024-03-25 17:46:47
6
6
* Author: 3urobeat
7
7
*
8
- * Last Modified: 2024-03-25 21:05:46
8
+ * Last Modified: 2024-04-11 18:52:19
9
9
* Modified By: 3urobeat
10
10
*
11
11
* Copyright (c) 2024 3urobeat <https://github.com/3urobeat>
18
18
19
19
20
20
<template >
21
- <div id =" title" class =" font-semibold underline underline-offset-4 pb-5 lg:pb-7 pt-10 select-none" >
22
- Settings
21
+ <div id =" title" class =" flex w-full pb-5 lg:pb-7 pt-10 select-none" >
22
+ <p class =" w-full font-semibold underline underline-offset-4" >Settings</p >
23
+
24
+ <!-- Save button -->
25
+ <div class =" flex justify-end items-center" >
26
+ <button class =" flex items-center justify-center py-1 px-3 rounded-sm bg-gray-100 outline outline-black outline-2 hover:bg-gray-200 hover:transition-all" @click =" saveChanges" >
27
+ <PhCheck class =" mr-2 size-5 text-green-600" ></PhCheck >
28
+ Save
29
+ </button >
30
+ </div >
31
+ </div >
32
+
33
+ <div class =" lg:flex lg:flex-col lg:mx-12" > <!-- Offset content to the right on desktop to give headline more presence -->
34
+ <div id =" gitconfig" >
35
+ <p class =" font-semibold" >Git Config:</p >
36
+ <textarea class =" lg:w-2/4 w-full h-64 opacity-60 my-1 px-1 bg-slate-200 rounded-sm outline outline-black outline-2" v-model =" settings.gitConfig" ></textarea >
37
+ </div >
23
38
</div >
24
39
</template >
25
40
26
41
27
42
<script setup lang="ts">
43
+ import { PhCheck } from " @phosphor-icons/vue" ;
44
+ import type { Settings } from " ~/model/settings" ;
45
+
46
+
47
+ // Refs
48
+ const settings: Ref <Settings > = ref ({
49
+ gitConfig: " "
50
+ });
51
+
52
+
53
+ // Load data
54
+ const serverData = await useFetch <any >(" /api/get-settings" );
55
+
56
+ settings .value = serverData .data .value ;
57
+
58
+
59
+ // Sends changes to the database
60
+ async function saveChanges() {
61
+ await useFetch (" /api/set-settings" , {
62
+ method: " POST" ,
63
+ headers: {
64
+ " Content-Type" : " application/json"
65
+ },
66
+ body: JSON .stringify (settings .value )
67
+ });
68
+ }
28
69
29
70
</script >
You can’t perform that action at this time.
0 commit comments