Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/kick #1076

Closed
wants to merge 13 commits into from
34 changes: 9 additions & 25 deletions src/site/kick.com/KickSite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { defineAsyncComponent, provide } from "vue";
import { useStore } from "@/store/main";
import { SITE_CURRENT_PLATFORM } from "@/common/Constant";
import { useActor } from "@/composable/useActor";
import { useCookies } from "@/composable/useCookies";
import { getModule } from "@/composable/useModule";
import { useSettings } from "@/composable/useSettings";
import { useUserAgent } from "@/composable/useUserAgent";
import { useApp } from "./composable/useApp";
import { usePinia } from "./composable/usePinia";
// import { useApp } from ".x/composable/useApp";
import { useUserdata } from "./composable/useUserdata";
import { KickModuleID } from "@/types/kick.module";

const ModuleWrapper = defineAsyncComponent(() => import("@/site/global/ModuleWrapper.vue"));
Expand All @@ -31,27 +32,13 @@ store.setPlatform("KICK", ["7TV"], []);

document.body.setAttribute("seventv-kick", "true");

const app = useApp();
const user = usePinia<{
user: {
id: number;
username: string;
bio: string;
email: string;
streamer_channel: {
slug: string;
};
discord?: string;
facebook?: string;
twitter?: string;
youtube?: string;
tiktok?: string;
instagram?: string;
};
}>(app, "user");
const cookies = useCookies();
const auth = cookies.get("XSRF-TOKEN");

const user = auth ? await useUserdata(auth) : null;

if (user) {
const updateIdentity = (data: typeof user.$state.user) => {
const updateIdentity = (data: typeof user) => {
if (!data || !data.id) return;

store.setIdentity("KICK", {
Expand All @@ -71,10 +58,7 @@ if (user) {
actor.setPlatformUserID("KICK", data.id.toString());
};

user.$subscribe(() => {
updateIdentity(user.$state.user);
});
updateIdentity(user.$state.user);
updateIdentity(user);
}

provide(SITE_CURRENT_PLATFORM, "KICK");
Expand Down
15 changes: 0 additions & 15 deletions src/site/kick.com/composable/useApp.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/site/kick.com/composable/usePinia.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/site/kick.com/composable/useRouter.ts

This file was deleted.

24 changes: 24 additions & 0 deletions src/site/kick.com/composable/useUserdata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export async function useUserdata(auth: string): Promise<{
id: number;
username: string;
bio: string;
email: string;
streamer_channel: {
slug: string;
};
discord?: string;
facebook?: string;
twitter?: string;
youtube?: string;
tiktok?: string;
instagram?: string;
}> {
const data = await fetch("https://kick.com/api/v1/user", {
headers: {
"X-XSRF-TOKEN": auth,
},
method: "GET",
});

return await data.json();
}
61 changes: 0 additions & 61 deletions src/site/kick.com/modules/auth/AuthModule.vue

This file was deleted.

Loading
Loading