Skip to content

Commit

Permalink
update friend list
Browse files Browse the repository at this point in the history
  • Loading branch information
metkm committed Jun 8, 2022
1 parent 2e0770f commit ed41347
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/views/Verify.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script setup lang="ts">
import { ref } from "vue";
import { onMounted, ref } from "vue";
import { http } from "@tauri-apps/api";
import { useRouter } from "vue-router";
import { useStore } from "../store";
import AppInput from "../components/AppInput.vue";
import { getTokens } from "../utils";
import { UserObject } from "../types";
// updateFriends();
const router = useRouter();
Expand All @@ -15,6 +16,22 @@ const store = useStore();
const code = ref(null);
const error = ref("");
const updateFriends = async () => {
const client = await http.getClient();
const response = await client.get<string>("https://osu.ppy.sh/home/friends", {
responseType: 2,
headers: {
"cookie": `osu_session=${store.state.auth.session}`
}
});
const dom = new DOMParser().parseFromString(response.data, "text/html");
let jsonUsers = JSON.parse(dom.getElementById("json-users")!.innerText) as UserObject[];
store.dispatch("setFriends", jsonUsers.map(user => user.id));
}
onMounted(updateFriends);
const verify = async () => {
const client = await http.getClient();
const response = await client.post("https://osu.ppy.sh/home/account/verify", {
Expand Down

0 comments on commit ed41347

Please sign in to comment.