-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): support multiple local novel favored (#89)
Co-authored-by: FishHawk <[email protected]>
- Loading branch information
Showing
31 changed files
with
427 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export interface Favored { | ||
id: string; | ||
title: string; | ||
} | ||
|
||
export interface FavoredList { | ||
web: Favored[]; | ||
wenku: Favored[]; | ||
local: Favored[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { client } from '@/data/api/client'; | ||
|
||
import { Favored } from './Favored'; | ||
|
||
interface FavoredList { | ||
favoredWeb: Favored[]; | ||
favoredWenku: Favored[]; | ||
} | ||
const listFavored = () => client.get('user/favored').json<FavoredList>(); | ||
|
||
// | ||
|
||
const createFavoredWeb = (json: { title: string }) => | ||
client.post(`user/favored-web`, { json }).text(); | ||
|
||
const updateFavoredWeb = (favoredId: string, json: { title: string }) => | ||
client.put(`user/favored-web/${favoredId}`, { json }); | ||
|
||
const deleteFavoredWeb = (favoredId: string) => | ||
client.delete(`user/favored-web/${favoredId}`); | ||
|
||
const favoriteWebNovel = ( | ||
favoredId: string, | ||
providerId: string, | ||
novelId: string, | ||
) => client.put(`user/favored-web/${favoredId}/${providerId}/${novelId}`); | ||
|
||
const unfavoriteWebNovel = ( | ||
favoredId: string, | ||
providerId: string, | ||
novelId: string, | ||
) => client.delete(`user/favored-web/${favoredId}/${providerId}/${novelId}`); | ||
|
||
// | ||
|
||
const createFavoredWenku = (json: { title: string }) => | ||
client.post(`user/favored-wenku`, { json }).text(); | ||
|
||
const updateFavoredWenku = (favoredId: string, json: { title: string }) => | ||
client.put(`user/favored-wenku/${favoredId}`, { json }); | ||
|
||
const deleteFavoredWenku = (favoredId: string) => | ||
client.delete(`user/favored-wenku/${favoredId}`); | ||
|
||
const favoriteWenkuNovel = (favoredId: string, novelId: string) => | ||
client.put(`user/favored-wenku/${favoredId}/${novelId}`); | ||
|
||
const unfavoriteWenkuNovel = (favoredId: string, novelId: string) => | ||
client.delete(`user/favored-wenku/${favoredId}/${novelId}`); | ||
|
||
export const FavoredApi = { | ||
listFavored, | ||
// | ||
createFavoredWeb, | ||
updateFavoredWeb, | ||
deleteFavoredWeb, | ||
favoriteWebNovel, | ||
unfavoriteWebNovel, | ||
// | ||
createFavoredWenku, | ||
updateFavoredWenku, | ||
deleteFavoredWenku, | ||
favoriteWenkuNovel, | ||
unfavoriteWenkuNovel, | ||
}; |
Oops, something went wrong.