Add promote / demote user to admin and reintroduce create user dashboard
Some checks failed
Deploy with Docker Compose / deploy (push) Failing after 24s
Some checks failed
Deploy with Docker Compose / deploy (push) Failing after 24s
This commit is contained in:
@@ -59,6 +59,16 @@ export const useAuthStore = defineStore("auth", () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function setUserAdmin(userId, admin) {
|
||||
try {
|
||||
const res = await axios.patch(`/api/user/${userId}/admin`, { admin });
|
||||
return res.data;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
user,
|
||||
|
||||
@@ -69,5 +79,6 @@ export const useAuthStore = defineStore("auth", () => {
|
||||
refreshToken,
|
||||
logOut,
|
||||
createUser,
|
||||
setUserAdmin,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import CreatePost from "./CreatePost.vue";
|
||||
import CreateFavorite from "./CreateFavorite.vue";
|
||||
import CreateActivity from "./CreateActivity.vue";
|
||||
import CreateRowing from "./CreateRowing.vue";
|
||||
import ManageUsers from "./ManageUsers.vue";
|
||||
|
||||
const auth = useAuthStore();
|
||||
</script>
|
||||
@@ -21,6 +22,7 @@ const auth = useAuthStore();
|
||||
<CreateFavorite class="bdr-2 bg-bg_primary" v-if="auth.loggedIn" />
|
||||
<CreateActivity class="bdr-2 bg-bg_primary" v-if="auth.loggedIn" />
|
||||
<CreateRowing class="bdr-2 bg-bg_primary" v-if="auth.loggedIn" />
|
||||
<ManageUsers class="bdr-2 bg-bg_primary" v-if="auth.loggedIn" />
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user