Skip to content

Commit

Permalink
style: remove manually adding cookies when logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkontoask committed Dec 26, 2020
1 parent 087e70c commit 7250d05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { SongsDetail, SongState, Albums } from '@/interface/index'
export const getSongUrl = async <T>(id: number | number[]): Promise<T> => {
const data = await get<{ data: T }>('/api/song/url', {
id: Array.isArray(id) ? id.join(',') : id,
br: 9.99e5,
timestamp: Date.now()
br: 9.99e5
})
return data.data
}
Expand All @@ -14,8 +13,7 @@ export const getSongDetail = async (
id: number | number[]
): Promise<SongsDetail[]> => {
const data = await get<{ songs: SongsDetail[] }>('/api/song/detail', {
ids: typeof id === 'number' ? id : id.join(','),
timestamp: Date.now()
ids: typeof id === 'number' ? id : id.join(',')
})
return data.songs
}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/auth/sage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export const mutations = {
// Set cookies manually
// see https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Set-Cookie
// see https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content
if (info) {
info.cookie.split(';;').forEach(str => {
document.cookie = str
})
}
// if (info) {
// info.cookie.split(';;').forEach(str => {
// document.cookie = str
// })
// }
state.user = info
},
[AUTH_MUTATIONS.LOGOUT]: (state: AuthState) => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/footer/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export { getSongDetail, getSongUrl } from '@/api/index'

export const getLyric = async (id: number): Promise<string> => {
const data = await get<SongsDetail>('/api/lyric', {
id,
timestamp: Date.now()
id
})
return data.lrc.lyric
}

0 comments on commit 7250d05

Please sign in to comment.