Feature: User auth #15
|
@ -2,7 +2,7 @@ import { reactive } from "vue"
|
|||
import { Track } from "./track"
|
||||
|
||||
import { Tick } from './ticks'
|
||||
import { error } from "./error"
|
||||
import { getCookie } from "./util";
|
||||
import { getCookie, dateQuery } from "./util";
|
||||
import router from './router'
|
||||
|
||||
enum State {
|
||||
|
@ -11,15 +11,6 @@ enum State {
|
|||
Fetched,
|
||||
}
|
||||
|
||||
function dateQuery(date: Date): URLSearchParams {
|
||||
let query = new URLSearchParams()
|
||||
query.set("year", date.getUTCFullYear().toString())
|
||||
query.set("month", (date.getUTCMonth() + 1).toString())
|
||||
// good thing I still had this ^^^^^^^^^^^^^^ in mind when I wrote this 😬
|
||||
query.set("day", date.getUTCDate().toString())
|
||||
return query
|
||||
}
|
||||
|
||||
interface LoggedInUser {
|
||||
name: string
|
||||
}
|
||||
|
|
|
@ -5,4 +5,13 @@ export function getCookie(key: string): string | null {
|
|||
if(end === -1)
|
||||
end = undefined
|
||||
return document.cookie.substring(start + key.length + 1, end)
|
||||
}
|
||||
}
|
||||
|
||||
export function dateQuery(date: Date): URLSearchParams {
|
||||
let query = new URLSearchParams()
|
||||
query.set("year", date.getUTCFullYear().toString())
|
||||
query.set("month", (date.getUTCMonth() + 1).toString())
|
||||
// good thing I still had this ^^^^^^^^^^^^^^ in mind when I wrote this 😬
|
||||
query.set("day", date.getUTCDate().toString())
|
||||
return query
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue
Have you tried out vuex or the newer pinia yet?
It's been a while since I looked into it, but I think I remember reading something in their docs which suggested that they might be overkill for this situation.