<repo_name>bedairhassan/Minimalistic-Social-Media<file_sep>/src/JS/tools.js
let shortDate = ()=>{
    let date = new Date();
    date = date+''
    date = date.split(" ")
    return date[0]+' '+date[1]+' '+date[2]+' '+date[3]+' '+date[4]
}

// export const shortDate;
module.exports={
    shortDate
}<file_sep>/src/JS/firebase.js
import firebase from 'firebase/app'
import 'firebase/firestore'

var firebaseConfig = {
    apiKey: "<KEY>",
    authDomain: "facebook-9cc04.firebaseapp.com",
    projectId: "facebook-9cc04",
    storageBucket: "facebook-9cc04.appspot.com",
    messagingSenderId: "542807902668",
    appId: "1:542807902668:web:cd2a0d2b9b602ee3243569"
};

firebase.initializeApp(firebaseConfig);

export const db = firebase.firestore()<file_sep>/src/visuals/Admin/DeleteUser/tools.js
// import { db } from '../../../JS/firebase'

const deleteUser = (db,user) => {
    db.collection("posts").onSnapshot((snap) => {
        snap = snap.docs
            .map((snap) => snap.data())
            .filter((snap) => snap.user == user) // filter by selected user
            .map((snap) => snap.id) // fetch array of ids
            .map((doc) => db.collection("posts").doc(doc).delete());
    });

    db.collection("sign").onSnapshot((snap) => {
        snap = snap.docs
            .map((snap) => snap.data())
            .filter((snap) => snap.username == user) // filter by selected user
            .map((snap) => snap.username)
            .map((doc) => db.collection("sign").doc(doc).delete());
    });

    db.collection("whisper").onSnapshot((snap) => {
        snap = snap.docs
            .map((snap) => snap.data())
            .filter((snap) => snap.sender == user || snap.receiver == user) // filter by selected user
            .map((snap) => snap.id)
            .map((doc) => db.collection("whisper").doc(doc).delete());
    });

    db.collection("friends").onSnapshot((snap) => {
        snap = snap.docs
            .map((snap) => snap.data())
            .filter((snap) => InList(snap.who.split(","), user)) // filter by selected user
            .map((snap) => snap.who)
            .map((doc) => db.collection("friends").doc(doc).delete());
    });
};

module.exports = {
    deleteUser
}<file_sep>/src/store/routeStore.js
import { writable } from 'svelte/store';

const WHISPER = 'whisper'
const FRIEND = 'friend'
const POST = 'post'
const LOGIN = 'login'

const route = writable(

    {
        render: [
            WHISPER,
            FRIEND,
            POST
        ], routes: {
            WHISPER,
            FRIEND,
            POST,
            LOGIN
        }
    }
    // obj:{

    // }
)

export default route


