Browse Source

* Removed last alerts

master
vvandenb 2 years ago
parent
commit
aa5628d077
  1. 8
      front/volume/src/App.svelte
  2. 5
      front/volume/src/Auth.ts
  3. 4
      front/volume/src/components/Channels.svelte
  4. 5
      front/volume/src/components/Friends.svelte

8
front/volume/src/App.svelte

@ -24,7 +24,7 @@
import Chat from "./components/Chat.svelte"; import Chat from "./components/Chat.svelte";
import Channels, { formatChannelNames, type chatMessagesType } from "./components/Channels.svelte"; import Channels, { formatChannelNames, type chatMessagesType } from "./components/Channels.svelte";
import Leaderboard from "./components/Leaderboard.svelte"; import Leaderboard from "./components/Leaderboard.svelte";
import { popup } from "./components/Alert/content"; import { popup, show_popup } from "./components/Alert/content";
import Pong from "./components/Pong/Pong.svelte"; import Pong from "./components/Pong/Pong.svelte";
import type { ChannelsType } from "./components/Channels.svelte"; import type { ChannelsType } from "./components/Channels.svelte";
import { API_URL } from "./Auth"; import { API_URL } from "./Auth";
@ -115,13 +115,13 @@
await formatChannelNames(DMChannel) await formatChannelNames(DMChannel)
setAppState(APPSTATE.CHANNELS + "#" + DMChannel[0].name) setAppState(APPSTATE.CHANNELS + "#" + DMChannel[0].name)
} else { } else {
alert("Error creating DM"); show_popup("Error: Couldn't create DM.", false)
} }
} else { } else {
alert("Error creating DM"); show_popup("Error: Couldn't create DM.", false)
} }
}).catch(() => { }).catch(() => {
alert("Error creating DM"); show_popup("Error: Couldn't create DM.", false)
}) })
} }
} }

5
front/volume/src/Auth.ts

@ -1,4 +1,5 @@
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { show_popup } from "./components/Alert/content";
let _user = localStorage.getItem("user"); let _user = localStorage.getItem("user");
export const store = writable(_user ? JSON.parse(_user) : null); export const store = writable(_user ? JSON.parse(_user) : null);
@ -35,9 +36,9 @@ export function verify() {
mode: "cors", mode: "cors",
credentials: "include", credentials: "include",
}); });
alert( show_popup(
"We have sent you an email to verify your account. Check the mailbox which is linked to your 42's profile." "We have sent you an email to verify your account. Check the mailbox which is linked to your 42's profile."
); , false);
} }
export function logout() { export function logout() {

4
front/volume/src/components/Channels.svelte

@ -1,7 +1,5 @@
<script lang="ts" context="module"> <script lang="ts" context="module">
import { content, show_popup } from './Alert/content' import { content, show_popup } from './Alert/content'
const showDialog = () => {
}
export interface ChannelsType { export interface ChannelsType {
id: number; id: number;

5
front/volume/src/components/Friends.svelte

@ -17,10 +17,10 @@
mode: "cors", mode: "cors",
}); });
if (response.ok) { if (response.ok) {
alert("Invitation send."); show_popup("Invitation send.", false);
} else { } else {
const error = (await response.json()).message; const error = (await response.json()).message;
alert("Invitation failed: " + error); show_popup("Invitation failed: " + error, false);
} }
} }
</script> </script>
@ -28,6 +28,7 @@
<script lang="ts"> <script lang="ts">
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
import { API_URL, store } from "../Auth"; import { API_URL, store } from "../Auth";
import { show_popup } from "./Alert/content";
let friends: Friend[] = []; let friends: Friend[] = [];
let invits: Friend[] = []; let invits: Friend[] = [];

Loading…
Cancel
Save